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, org.apache.hc.core5.http.HttpConnection, org.apache.hc.core5.http.io.BHttpConnection, org.apache.hc.core5.http.io.HttpClientConnection, org.apache.hc.core5.http.protocol.HttpContext

    @NotThreadSafe
    public class DefaultManagedHttpClientConnection
    extends org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
    implements ManagedHttpClientConnection, org.apache.hc.core5.http.protocol.HttpContext

Default `ManagedHttpClientConnection` implementation.

Since:
  4.3

### Field Summary

### Fields inherited from interface org.apache.hc.core5.http.protocol.HttpContext

`RESERVED_PREFIX`

### Constructor Summary

Constructors
Constructor and Description
`DefaultManagedHttpClientConnection(String id, int buffersize)`

`DefaultManagedHttpClientConnection(String id, int buffersize, int fragmentSizeHint, CharsetDecoder chardecoder, CharsetEncoder charencoder, org.apache.hc.core5.http.config.MessageConstraints constraints, org.apache.hc.core5.http.ContentLengthStrategy incomingContentStrategy, org.apache.hc.core5.http.ContentLengthStrategy outgoingContentStrategy, org.apache.hc.core5.http.io.HttpMessageWriterFactory<org.apache.hc.core5.http.HttpRequest> requestWriterFactory, org.apache.hc.core5.http.io.HttpMessageParserFactory<org.apache.hc.core5.http.HttpResponse> responseParserFactory)`

### Method Summary

Methods
`protected boolean` `awaitInput(int arg0)`
`void` `bind(Socket socket)` Binds this connection to the given socket.
`protected InputStream` `createContentInputStream(long arg0, org.apache.hc.core5.http.io.SessionInputBuffer arg1)`
`protected OutputStream` `createContentOutputStream(long arg0, org.apache.hc.core5.http.io.SessionOutputBuffer arg1, org.apache.hc.core5.http.TrailerSupplier arg2)`
`protected void` `ensureOpen()`
`Object` `getAttribute(String id)`
`String` `getId()` Returns connection ID which is expected to be unique for the life span of the connection manager.
`Socket` `getSocket()` Returns the underlying socket.
`protected InputStream` `getSocketInputStream(Socket arg0)`
`protected OutputStream` `getSocketOutputStream(Socket arg0)`
`SSLSession` `getSSLSession()` Obtains the SSL session of the underlying connection, if any.
`protected void` `incrementRequestCount()`
`protected void` `incrementResponseCount()`
`Object` `removeAttribute(String id)`
`void` `setAttribute(String id, Object obj)`
`void` `shutdown()`

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

`isConsistent, onRequestSubmitted, onResponseReceived, 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

`close, getLocalAddress, getMetrics, getRemoteAddress, getSocketTimeout, isOpen, setSocketTimeout`

### Constructor Detail

#### DefaultManagedHttpClientConnection

    public DefaultManagedHttpClientConnection(String id,
                                      int buffersize,
                                      int fragmentSizeHint,
                                      CharsetDecoder chardecoder,
                                      CharsetEncoder charencoder,
                                      org.apache.hc.core5.http.config.MessageConstraints constraints,
                                      org.apache.hc.core5.http.ContentLengthStrategy incomingContentStrategy,
                                      org.apache.hc.core5.http.ContentLengthStrategy outgoingContentStrategy,
                                      org.apache.hc.core5.http.io.HttpMessageWriterFactory<org.apache.hc.core5.http.HttpRequest> requestWriterFactory,
                                      org.apache.hc.core5.http.io.HttpMessageParserFactory<org.apache.hc.core5.http.HttpResponse> responseParserFactory)

#### DefaultManagedHttpClientConnection

    public DefaultManagedHttpClientConnection(String id,
                                      int buffersize)

### Method Detail

#### getId

    public String getId()

Description copied from interface: `ManagedHttpClientConnection`
Returns connection ID which is expected to be unique for the life span of the connection manager.

Specified by:
  `getId` in interface `ManagedHttpClientConnection`

#### shutdown

    public void shutdown()
                  throws IOException

Specified by:
  `shutdown` in interface `org.apache.hc.core5.http.HttpConnection`
Overrides:
  `shutdown` in class `org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection`
Throws:
  `IOException`

#### getAttribute

    public Object getAttribute(String id)

Specified by:
  `getAttribute` in interface `org.apache.hc.core5.http.protocol.HttpContext`

#### removeAttribute

    public Object removeAttribute(String id)

Specified by:
  `removeAttribute` in interface `org.apache.hc.core5.http.protocol.HttpContext`

#### setAttribute

    public void setAttribute(String id,
                    Object obj)

Specified by:
  `setAttribute` in interface `org.apache.hc.core5.http.protocol.HttpContext`

#### 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 `org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection`
Parameters:
  `socket` - the socket to bind the connection to.
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`
Returns:
  the underlying SSL session if available, `null` otherwise

#### ensureOpen

    protected void ensureOpen()
                       throws IOException

Throws:
  `IOException`

#### getSocketInputStream

    protected InputStream getSocketInputStream(Socket arg0)
                                        throws IOException

Throws:
  `IOException`

#### getSocketOutputStream

    protected OutputStream getSocketOutputStream(Socket arg0)
                                          throws IOException

Throws:
  `IOException`

#### createContentOutputStream

    protected OutputStream createContentOutputStream(long arg0,
                                         org.apache.hc.core5.http.io.SessionOutputBuffer arg1,
                                         org.apache.hc.core5.http.TrailerSupplier arg2)

#### createContentInputStream

    protected InputStream createContentInputStream(long arg0,
                                       org.apache.hc.core5.http.io.SessionInputBuffer arg1)

#### awaitInput

    protected boolean awaitInput(int arg0)
                          throws IOException

Throws:
  `IOException`

#### incrementRequestCount

    protected void incrementRequestCount()

#### incrementResponseCount

    protected void incrementResponseCount()