# Class DefaultConnectionFactory (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.http.javanet.DefaultConnectionFactory)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.http.javanet.DefaultConnectionFactory)

    public class DefaultConnectionFactory implements ConnectionFactory

Default implementation of [ConnectionFactory](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.javanet.ConnectionFactory), which simply attempts to open the connection
with an optional [Proxy](https://docs.oracle.com/javase/8/docs/api/java/net/Proxy.html).

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> DefaultConnectionFactory

## Implements

[ConnectionFactory](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.javanet.ConnectionFactory)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### DefaultConnectionFactory()

    public DefaultConnectionFactory()

### DefaultConnectionFactory(Proxy proxy)

    public DefaultConnectionFactory(Proxy proxy)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `proxy` | `https://docs.oracle.com/javase/8/docs/api/java/net/Proxy.html` HTTP proxy or `null` to use the proxy settings from [system properties](http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html) |

## Methods

### openConnection(URL url)

    public HttpURLConnection openConnection(URL url)

Creates a new [HttpURLConnection](https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html) from the given `url`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `url` | `https://docs.oracle.com/javase/8/docs/api/java/net/URL.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |