Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions) Summary: [Methods](https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#inhmethods)

# Proxy.HttpConnectCallback.Request

*** ** * ** ***

` public static final class Proxy.HttpConnectCallback.Request `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/lang/AutoCloseable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.http.Proxy.HttpConnectCallback.Request |

<br />

*** ** * ** ***

Represents an HTTP CONNECT request being sent to the proxy server.

All methods may be called synchronously or asynchronously, on any thread.

## Summary

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#close()() ` Releases all resources associated with the tunnel establishment request. |
| ` void` | ` https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#proceed(java.util.List<android.util.Pair<java.lang.String,java.lang.String>>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/util/Pair<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/lang/String>> extraHeaders) ` Allows the tunnel establishment request to proceed, adding the extra headers to the underlying HTTP CONNECT request. |

### 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*.
From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` ` abstract void` ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() `

Closes this resource, relinquishing any underlying resources.

## Public methods

### close

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

```
public void close ()
```

Releases all resources associated with the tunnel establishment request.

If this method is called after `https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#proceed(java.util.List<android.util.Pair<java.lang.String,java.lang.String>>)`, this will have no effect on the tunnel establishment request and the underlying HTTP CONNECT, they will keep proceeding.

If this method is called before `https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#proceed(java.util.List<android.util.Pair<java.lang.String,java.lang.String>>)`, the tunnel establishment request and the underlying HTTP CONNECT request will be canceled.

When a tunnel establishment request is canceled, HttpEngine will interpret it as a failure to use the associated `https://developer.android.com/reference/android/net/http/Proxy`. HttpEngine will then try the next `https://developer.android.com/reference/android/net/http/Proxy` in the list passed to `https://developer.android.com/reference/android/net/http/ProxyOptions` (refer to that class documentation for more info).

<br />

### proceed

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public void proceed (List<Pair<String, String>> extraHeaders)
```

Allows the tunnel establishment request to proceed, adding the extra headers to the underlying HTTP CONNECT request.

<br />

| Parameters ||
|---|---|
| `extraHeaders` | `List`: A list of RFC 2616-compliant headers to be added to HTTP CONNECT request directed to the proxy server. This list can be empty, in which case no headers will be added. Note: these headers won't be added to the HTTP requests that will go through the tunnel once it is established. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If any of the headers is not RFC 2616-compliant. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | If this method is called multiple times, or after `https://developer.android.com/reference/android/net/http/Proxy.HttpConnectCallback.Request#close()` has been called. |