org.apache.hc.client5.http.io

## Interface ManagedHttpClientConnection

- All Superinterfaces:
    AutoCloseable, org.apache.hc.core5.http.io.BHttpConnection, Closeable, org.apache.hc.core5.http.io.HttpClientConnection, org.apache.hc.core5.http.HttpConnection, org.apache.hc.core5.io.ModalCloseable, org.apache.hc.core5.http.SocketModalCloseable

      @Internal
      public interface ManagedHttpClientConnection
      extends org.apache.hc.core5.http.io.HttpClientConnection

  Represents a managed connection whose state and life cycle is managed by a connection manager. This interface extends `HttpClientConnection` with methods to bind the connection to an arbitrary socket and to obtain SSL session details.
  Since:
    4.3

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activate()` Restores the connection from idle mode.
    `void` | `bind(Socket socket)` Binds this connection to the given socket.
    `default void` | `bind(SSLSocket sslSocket, Socket socket)` Binds this connection to the SSL given socket and the underlying network socket.
    `Socket` | `getSocket()` Returns the underlying socket.
    `SSLSession` | `getSSLSession()` Obtains the SSL session of the underlying connection, if any.
    `void` | `passivate()` Puts the connection into idle mode.

    - ### 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, getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, isOpen`

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

      `getSocketTimeout, setSocketTimeout`

    - ### Methods inherited from interface org.apache.hc.core5.io.ModalCloseable

      `close`

- - ### Method Detail

    - #### bind

          void bind(Socket socket)
             throws IOException

      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.
      Parameters:
        `socket` - the socket to bind the connection to.
      Throws:
        `IOException`

    - #### bind

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

      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).
      Parameters:
        `sslSocket` - the SSL socket to bind the connection to.
        `socket` - the underlying network socket of the SSL socket.
      Throws:
        `IOException`
      Since:
        5.4

    - #### getSocket

          Socket getSocket()

      Returns the underlying socket.

    - #### getSSLSession

          SSLSession getSSLSession()

      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 `org.apache.hc.core5.http.HttpConnection`
      Returns:
        the underlying SSL session if available, `null` otherwise

    - #### passivate

          void passivate()

      Puts the connection into idle mode.
      Since:
        5.0

    - #### activate

          void activate()

      Restores the connection from idle mode.
      Since:
        5.0

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.