org.apache.hc.client5.http.impl.io

## Class DefaultManagedHttpClientConnection

- java.lang.Object
- - org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
  - - org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection

All Implemented Interfaces:
  Closeable, AutoCloseable, ManagedHttpClientConnection, HttpConnection, BHttpConnection, HttpClientConnection, SocketModalCloseable, ModalCloseable, Identifiable

    @Internal
    public class DefaultManagedHttpClientConnection
    extends DefaultBHttpClientConnection
    implements ManagedHttpClientConnection, Identifiable

### Constructor Summary

Constructors
Constructor and Description
`DefaultManagedHttpClientConnection(String id)`
`DefaultManagedHttpClientConnection(String id, CharsetDecoder charDecoder, CharsetEncoder charEncoder, Http1Config h1Config, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory, HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)`

`DefaultManagedHttpClientConnection(String id, CharsetDecoder charDecoder, CharsetEncoder charEncoder, Http1Config h1Config, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, ResponseOutOfOrderStrategy responseOutOfOrderStrategy, HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory, HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `activate()` Restores the connection from idle mode.
`protected boolean` `awaitInput(Timeout arg0)`
`void` `bind(Socket socket)` Binds this connection to the given socket.
`void` `bind(SocketHolder socketHolder)`
`void` `bind(SSLSocket sslSocket, Socket socket)` Binds this connection to the SSL given socket and the underlying network socket.
`void` `close()`
`void` `close(CloseMode closeMode)`
`protected InputStream` `createContentInputStream(long arg0, SessionInputBuffer arg1, InputStream arg2)`
`protected OutputStream` `createContentOutputStream(long arg0, SessionOutputBuffer arg1, OutputStream arg2, Supplier<List<? extends Header>> arg3)`
`protected SocketHolder` `ensureOpen()`
`String` `getId()`
`Socket` `getSocket()` Returns the underlying socket.
`protected SocketHolder` `getSocketHolder()`
`SSLSession` `getSSLSession()` Obtains the SSL session of the underlying connection, if any.
`protected void` `incrementRequestCount()`
`protected void` `incrementResponseCount()`
`protected void` `onRequestSubmitted(ClassicHttpRequest request)`
`protected void` `onResponseReceived(ClassicHttpResponse response)`
`void` `passivate()` Puts the connection into idle mode.
`void` `setSocketTimeout(Timeout timeout)`

### Methods inherited from class org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection

`isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequest`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.hc.core5.http.io.HttpClientConnection

`isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequest`

### Methods inherited from interface org.apache.hc.core5.http.io.BHttpConnection

`flush, isDataAvailable, isStale`

### Methods inherited from interface org.apache.hc.core5.http.HttpConnection

`getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, isOpen`

### Methods inherited from interface org.apache.hc.core5.http.SocketModalCloseable

`getSocketTimeout`

### Constructor Detail

#### DefaultManagedHttpClientConnection

    public DefaultManagedHttpClientConnection(String id,
                                              CharsetDecoder charDecoder,
                                              CharsetEncoder charEncoder,
                                              Http1Config h1Config,
                                              ContentLengthStrategy incomingContentStrategy,
                                              ContentLengthStrategy outgoingContentStrategy,
                                              ResponseOutOfOrderStrategy responseOutOfOrderStrategy,
                                              HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
                                              HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)

#### DefaultManagedHttpClientConnection

    public DefaultManagedHttpClientConnection(String id,
                                              CharsetDecoder charDecoder,
                                              CharsetEncoder charEncoder,
                                              Http1Config h1Config,
                                              ContentLengthStrategy incomingContentStrategy,
                                              ContentLengthStrategy outgoingContentStrategy,
                                              HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
                                              HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)

#### DefaultManagedHttpClientConnection

    public DefaultManagedHttpClientConnection(String id)

### Method Detail

#### getId

    public String getId()

Specified by:
  `getId` in interface `Identifiable`

#### bind

    public void bind(SocketHolder socketHolder)
              throws IOException

Throws:
  `IOException`

#### getSocket

    public Socket getSocket()

Description copied from interface: `ManagedHttpClientConnection`
Returns the underlying socket.

Specified by:
  `getSocket` in interface `ManagedHttpClientConnection`

#### getSSLSession

    public SSLSession getSSLSession()

Description copied from interface: `ManagedHttpClientConnection`
Obtains the SSL session of the underlying connection, if any. If this connection is open, and the underlying socket is an `SSLSocket`, the SSL session of that socket is obtained. This is a potentially blocking operation.

Specified by:
  `getSSLSession` in interface `ManagedHttpClientConnection`
Specified by:
  `getSSLSession` in interface `HttpConnection`
Overrides:
  `getSSLSession` in class `DefaultBHttpClientConnection`
Returns:
  the underlying SSL session if available, `null` otherwise

#### close

    public void close()
               throws IOException

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `HttpConnection`
Overrides:
  `close` in class `DefaultBHttpClientConnection`
Throws:
  `IOException`

#### setSocketTimeout

    public void setSocketTimeout(Timeout timeout)

Specified by:
  `setSocketTimeout` in interface `SocketModalCloseable`
Overrides:
  `setSocketTimeout` in class `DefaultBHttpClientConnection`

#### close

    public void close(CloseMode closeMode)

Specified by:
  `close` in interface `ModalCloseable`
Overrides:
  `close` in class `DefaultBHttpClientConnection`

#### bind

    public void bind(Socket socket)
              throws IOException

Description copied from interface: `ManagedHttpClientConnection`
Binds this connection to the given socket. The connection is considered open if it is bound and the underlying socket is connection to a remote host.

Specified by:
  `bind` in interface `ManagedHttpClientConnection`
Overrides:
  `bind` in class `DefaultBHttpClientConnection`
Parameters:
  `socket` - the socket to bind the connection to.
Throws:
  `IOException`

#### bind

    public void bind(SSLSocket sslSocket,
                     Socket socket)
              throws IOException

Description copied from interface: `ManagedHttpClientConnection`
Binds this connection to the SSL given socket and the underlying network socket. The connection is considered open if it is bound, the underlying network socket is connection to a remote host and the SSL socket is fully initialized (TLS handshake has been successfully executed).

Specified by:
  `bind` in interface `ManagedHttpClientConnection`
Overrides:
  `bind` in class `DefaultBHttpClientConnection`
Parameters:
  `sslSocket` - the SSL socket to bind the connection to.
  `socket` - the underlying network socket of the SSL socket.
Throws:
  `IOException`

#### onResponseReceived

    protected void onResponseReceived(ClassicHttpResponse response)

Overrides:
  `onResponseReceived` in class `DefaultBHttpClientConnection`

#### onRequestSubmitted

    protected void onRequestSubmitted(ClassicHttpRequest request)

Overrides:
  `onRequestSubmitted` in class `DefaultBHttpClientConnection`

#### passivate

    public void passivate()

Description copied from interface: `ManagedHttpClientConnection`
Puts the connection into idle mode.

Specified by:
  `passivate` in interface `ManagedHttpClientConnection`

#### activate

    public void activate()

Description copied from interface: `ManagedHttpClientConnection`
Restores the connection from idle mode.

Specified by:
  `activate` in interface `ManagedHttpClientConnection`

#### ensureOpen

    protected SocketHolder ensureOpen()
                               throws IOException

Throws:
  `IOException`

#### getSocketHolder

    protected SocketHolder getSocketHolder()

#### createContentOutputStream

    protected OutputStream createContentOutputStream(long arg0,
                                                     SessionOutputBuffer arg1,
                                                     OutputStream arg2,
                                                     Supplier<List<? extends Header>> arg3)

#### createContentInputStream

    protected InputStream createContentInputStream(long arg0,
                                                   SessionInputBuffer arg1,
                                                   InputStream arg2)

#### awaitInput

    protected boolean awaitInput(Timeout arg0)
                          throws IOException

Throws:
  `IOException`

#### incrementRequestCount

    protected void incrementRequestCount()

#### incrementResponseCount

    protected void incrementResponseCount()