Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#inhconstants) \| [Methods](https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#inhmethods)

# HttpConnectionParams

` public final class HttpConnectionParams `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | org.apache.http.params.HttpConnectionParams |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 22.**   

Please use `https://developer.android.com/reference/java/net/URL#openConnection()` instead. Please visit [this webpage](http://android-developers.blogspot.com/2011/09/androids-http-clients.html) for further details.

An adaptor for accessing connection parameters in `https://developer.android.com/reference/org/apache/http/params/HttpParams`.   

Note that the *implements* relation to `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames` is for compatibility with existing application code only. References to the parameter names should use the interface, not this class.

## Summary

### Inherited constants

From interface `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#CONNECTION_TIMEOUT`

Determines the timeout until a connection is etablished.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#MAX_HEADER_COUNT`

Determines the maximum HTTP header count allowed.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#MAX_LINE_LENGTH`

Determines the maximum line length limit.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#SOCKET_BUFFER_SIZE`

Determines the size of the internal socket buffer used to buffer data while receiving / transmitting HTTP messages.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#SO_LINGER`

Sets SO_LINGER with the specified linger time in seconds.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#SO_TIMEOUT`

Defines the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#STALE_CONNECTION_CHECK`

Determines whether stale connection check is to be used.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/org/apache/http/params/CoreConnectionPNames#TCP_NODELAY`

Determines whether Nagle's algorithm is to be used.

| ### Public methods ||
|---|---|
| ` static int` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#getConnectionTimeout(org.apache.http.params.HttpParams)(https://developer.android.com/reference/org/apache/http/params/HttpParams params) ` Returns the timeout until a connection is etablished. |
| ` static int` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#getLinger(org.apache.http.params.HttpParams)(https://developer.android.com/reference/org/apache/http/params/HttpParams params) ` Returns linger-on-close timeout. |
| ` static int` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#getSoTimeout(org.apache.http.params.HttpParams)(https://developer.android.com/reference/org/apache/http/params/HttpParams params) ` Returns the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. |
| ` static int` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#getSocketBufferSize(org.apache.http.params.HttpParams)(https://developer.android.com/reference/org/apache/http/params/HttpParams params) ` |
| ` static boolean` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#getTcpNoDelay(org.apache.http.params.HttpParams)(https://developer.android.com/reference/org/apache/http/params/HttpParams params) ` Tests if Nagle's algorithm is to be used. |
| ` static boolean` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#isStaleCheckingEnabled(org.apache.http.params.HttpParams)(https://developer.android.com/reference/org/apache/http/params/HttpParams params) ` Tests whether stale connection check is to be used. |
| ` static void` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#setConnectionTimeout(org.apache.http.params.HttpParams,%20int)(https://developer.android.com/reference/org/apache/http/params/HttpParams params, int timeout) ` Sets the timeout until a connection is etablished. |
| ` static void` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#setLinger(org.apache.http.params.HttpParams,%20int)(https://developer.android.com/reference/org/apache/http/params/HttpParams params, int value) ` Returns linger-on-close timeout. |
| ` static void` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#setSoTimeout(org.apache.http.params.HttpParams,%20int)(https://developer.android.com/reference/org/apache/http/params/HttpParams params, int timeout) ` Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. |
| ` static void` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#setSocketBufferSize(org.apache.http.params.HttpParams,%20int)(https://developer.android.com/reference/org/apache/http/params/HttpParams params, int size) ` |
| ` static void` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#setStaleCheckingEnabled(org.apache.http.params.HttpParams,%20boolean)(https://developer.android.com/reference/org/apache/http/params/HttpParams params, boolean value) ` Defines whether stale connection check is to be used. |
| ` static void` | ` https://developer.android.com/reference/org/apache/http/params/HttpConnectionParams#setTcpNoDelay(org.apache.http.params.HttpParams,%20boolean)(https://developer.android.com/reference/org/apache/http/params/HttpParams params, boolean value) ` Determines whether Nagle's algorithm is to be used. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### getConnectionTimeout

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getConnectionTimeout (HttpParams params)
```

Returns the timeout until a connection is etablished. A value of zero means the timeout is not used. The default value is zero.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |

| Returns ||
|---|---|
| `int` | timeout in milliseconds. <br /> |

### getLinger

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getLinger (HttpParams params)
```

Returns linger-on-close timeout. Value 0 implies that the option is disabled. Value -1 implies that the JRE default is used.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |

| Returns ||
|---|---|
| `int` | the linger-on-close timeout <br /> |

### getSoTimeout

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getSoTimeout (HttpParams params)
```

Returns the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout. This value is used when no socket timeout is set in the method parameters.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |

| Returns ||
|---|---|
| `int` | timeout in milliseconds <br /> |

### getSocketBufferSize

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getSocketBufferSize (HttpParams params)
```

<br />

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

### getTcpNoDelay

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean getTcpNoDelay (HttpParams params)
```

Tests if Nagle's algorithm is to be used.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |

| Returns ||
|---|---|
| `boolean` | true if the Nagle's algorithm is to NOT be used (that is enable TCP_NODELAY), false otherwise. <br /> |

### isStaleCheckingEnabled

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isStaleCheckingEnabled (HttpParams params)
```

Tests whether stale connection check is to be used. Disabling stale connection check may result in slight performance improvement at the risk of getting an I/O error when executing a request over a connection that has been closed at the server side.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |

| Returns ||
|---|---|
| `boolean` | true if stale connection check is to be used, false otherwise. <br /> |

### setConnectionTimeout

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setConnectionTimeout (HttpParams params, 
                int timeout)
```

Sets the timeout until a connection is etablished. A value of zero means the timeout is not used. The default value is zero.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |
| `timeout` | `int`: Timeout in milliseconds. <br /> |

### setLinger

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setLinger (HttpParams params, 
                int value)
```

Returns linger-on-close timeout. This option disables/enables immediate return from a close() of a TCP Socket. Enabling this option with a non-zero Integer timeout means that a close() will block pending the transmission and acknowledgement of all data written to the peer, at which point the socket is closed gracefully. Value 0 implies that the option is disabled. Value -1 implies that the JRE default is used.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |
| `value` | `int`: the linger-on-close timeout <br /> |

### setSoTimeout

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setSoTimeout (HttpParams params, 
                int timeout)
```

Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout. This value is used when no socket timeout is set in the method parameters.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |
| `timeout` | `int`: Timeout in milliseconds <br /> |

### setSocketBufferSize

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setSocketBufferSize (HttpParams params, 
                int size)
```

<br />

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |
| `size` | `int` <br /> |

### setStaleCheckingEnabled

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setStaleCheckingEnabled (HttpParams params, 
                boolean value)
```

Defines whether stale connection check is to be used. Disabling stale connection check may result in slight performance improvement at the risk of getting an I/O error when executing a request over a connection that has been closed at the server side.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |
| `value` | `boolean`: true if stale connection check is to be used, false otherwise. <br /> |

### setTcpNoDelay

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setTcpNoDelay (HttpParams params, 
                boolean value)
```

Determines whether Nagle's algorithm is to be used. The Nagle's algorithm tries to conserve bandwidth by minimizing the number of segments that are sent. When applications wish to decrease network latency and increase performance, they can disable Nagle's algorithm (that is enable TCP_NODELAY). Data will be sent earlier, at the cost of an increase in bandwidth consumption.

<br />

| Parameters ||
|---|---|
| `params` | `HttpParams` <br /> |
| `value` | `boolean`: true if the Nagle's algorithm is to NOT be used (that is enable TCP_NODELAY), false otherwise. <br /> |