Class DefaultManagedAsyncClientConnection

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ManagedAsyncClientConnection, org.apache.hc.core5.http.HttpConnection, org.apache.hc.core5.http.SocketModalCloseable, org.apache.hc.core5.io.ModalCloseable, org.apache.hc.core5.reactor.ssl.TransportSecurityLayer, org.apache.hc.core5.util.Identifiable

    final class DefaultManagedAsyncClientConnection
    extends java.lang.Object
    implements ManagedAsyncClientConnection, org.apache.hc.core5.util.Identifiable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.atomic.AtomicBoolean closed  
      private org.apache.hc.core5.reactor.IOSession ioSession  
      private static org.slf4j.Logger LOG  
      private org.apache.hc.core5.util.Timeout socketTimeout  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activate()
      Restores the connection from idle mode.
      void close()  
      void close​(org.apache.hc.core5.io.CloseMode closeMode)  
      org.apache.hc.core5.http.EndpointDetails getEndpointDetails()  
      java.lang.String getId()  
      java.net.SocketAddress getLocalAddress()  
      org.apache.hc.core5.http.ProtocolVersion getProtocolVersion()  
      java.net.SocketAddress getRemoteAddress()  
      org.apache.hc.core5.util.Timeout getSocketTimeout()  
      javax.net.ssl.SSLSession getSSLSession()  
      org.apache.hc.core5.reactor.ssl.TlsDetails getTlsDetails()  
      boolean isOpen()  
      void passivate()
      Puts the connection into idle mode.
      void setSocketTimeout​(org.apache.hc.core5.util.Timeout timeout)  
      void startTls​(javax.net.ssl.SSLContext sslContext, org.apache.hc.core5.net.NamedEndpoint endpoint, org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferMode, org.apache.hc.core5.reactor.ssl.SSLSessionInitializer initializer, org.apache.hc.core5.reactor.ssl.SSLSessionVerifier verifier, org.apache.hc.core5.util.Timeout handshakeTimeout)  
      void startTls​(javax.net.ssl.SSLContext sslContext, org.apache.hc.core5.net.NamedEndpoint endpoint, org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferMode, org.apache.hc.core5.reactor.ssl.SSLSessionInitializer initializer, org.apache.hc.core5.reactor.ssl.SSLSessionVerifier verifier, org.apache.hc.core5.util.Timeout handshakeTimeout, org.apache.hc.core5.concurrent.FutureCallback<org.apache.hc.core5.reactor.ssl.TransportSecurityLayer> callback)  
      void submitCommand​(org.apache.hc.core5.reactor.Command command, org.apache.hc.core5.reactor.Command.Priority priority)
      Submits the given command for execution.
      void switchProtocol​(java.lang.String protocolId, org.apache.hc.core5.concurrent.FutureCallback<org.apache.hc.core5.reactor.ProtocolIOSession> callback)
      Switches this I/O session to the application protocol with the given ID.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • ioSession

        private final org.apache.hc.core5.reactor.IOSession ioSession
      • socketTimeout

        private final org.apache.hc.core5.util.Timeout socketTimeout
      • closed

        private final java.util.concurrent.atomic.AtomicBoolean closed
    • Constructor Detail

      • DefaultManagedAsyncClientConnection

        public DefaultManagedAsyncClientConnection​(org.apache.hc.core5.reactor.IOSession ioSession)
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface org.apache.hc.core5.util.Identifiable
      • close

        public void close​(org.apache.hc.core5.io.CloseMode closeMode)
        Specified by:
        close in interface org.apache.hc.core5.io.ModalCloseable
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.hc.core5.http.HttpConnection
        Throws:
        java.io.IOException
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface org.apache.hc.core5.http.HttpConnection
      • setSocketTimeout

        public void setSocketTimeout​(org.apache.hc.core5.util.Timeout timeout)
        Specified by:
        setSocketTimeout in interface org.apache.hc.core5.http.SocketModalCloseable
      • getSocketTimeout

        public org.apache.hc.core5.util.Timeout getSocketTimeout()
        Specified by:
        getSocketTimeout in interface org.apache.hc.core5.http.SocketModalCloseable
      • getRemoteAddress

        public java.net.SocketAddress getRemoteAddress()
        Specified by:
        getRemoteAddress in interface org.apache.hc.core5.http.HttpConnection
      • getLocalAddress

        public java.net.SocketAddress getLocalAddress()
        Specified by:
        getLocalAddress in interface org.apache.hc.core5.http.HttpConnection
      • getEndpointDetails

        public org.apache.hc.core5.http.EndpointDetails getEndpointDetails()
        Specified by:
        getEndpointDetails in interface org.apache.hc.core5.http.HttpConnection
      • getProtocolVersion

        public org.apache.hc.core5.http.ProtocolVersion getProtocolVersion()
        Specified by:
        getProtocolVersion in interface org.apache.hc.core5.http.HttpConnection
      • startTls

        public void startTls​(javax.net.ssl.SSLContext sslContext,
                             org.apache.hc.core5.net.NamedEndpoint endpoint,
                             org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferMode,
                             org.apache.hc.core5.reactor.ssl.SSLSessionInitializer initializer,
                             org.apache.hc.core5.reactor.ssl.SSLSessionVerifier verifier,
                             org.apache.hc.core5.util.Timeout handshakeTimeout,
                             org.apache.hc.core5.concurrent.FutureCallback<org.apache.hc.core5.reactor.ssl.TransportSecurityLayer> callback)
                      throws java.lang.UnsupportedOperationException
        Specified by:
        startTls in interface org.apache.hc.core5.reactor.ssl.TransportSecurityLayer
        Throws:
        java.lang.UnsupportedOperationException
      • startTls

        public void startTls​(javax.net.ssl.SSLContext sslContext,
                             org.apache.hc.core5.net.NamedEndpoint endpoint,
                             org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferMode,
                             org.apache.hc.core5.reactor.ssl.SSLSessionInitializer initializer,
                             org.apache.hc.core5.reactor.ssl.SSLSessionVerifier verifier,
                             org.apache.hc.core5.util.Timeout handshakeTimeout)
                      throws java.lang.UnsupportedOperationException
        Specified by:
        startTls in interface org.apache.hc.core5.reactor.ssl.TransportSecurityLayer
        Throws:
        java.lang.UnsupportedOperationException
      • getTlsDetails

        public org.apache.hc.core5.reactor.ssl.TlsDetails getTlsDetails()
        Specified by:
        getTlsDetails in interface org.apache.hc.core5.reactor.ssl.TransportSecurityLayer
      • getSSLSession

        public javax.net.ssl.SSLSession getSSLSession()
        Specified by:
        getSSLSession in interface org.apache.hc.core5.http.HttpConnection
      • submitCommand

        public void submitCommand​(org.apache.hc.core5.reactor.Command command,
                                  org.apache.hc.core5.reactor.Command.Priority priority)
        Description copied from interface: ManagedAsyncClientConnection
        Submits the given command for execution.
        Specified by:
        submitCommand in interface ManagedAsyncClientConnection
        Parameters:
        command - the command to be executed.
        priority - the command priority.
      • switchProtocol

        public void switchProtocol​(java.lang.String protocolId,
                                   org.apache.hc.core5.concurrent.FutureCallback<org.apache.hc.core5.reactor.ProtocolIOSession> callback)
                            throws java.lang.UnsupportedOperationException
        Description copied from interface: ManagedAsyncClientConnection
        Switches this I/O session to the application protocol with the given ID.
        Specified by:
        switchProtocol in interface ManagedAsyncClientConnection
        Parameters:
        protocolId - the application protocol ID
        callback - the result callback
        Throws:
        java.lang.UnsupportedOperationException - if application protocol switch is not supported.