Class ClientH2PrefaceHandler

java.lang.Object
org.apache.hc.core5.http2.impl.nio.ClientH2PrefaceHandler
All Implemented Interfaces:
Closeable, AutoCloseable, HttpConnection, HttpConnectionEventHandler, SocketModalCloseable, ModalCloseable, IOEventHandler

@Internal public class ClientH2PrefaceHandler extends Object
I/O event handler for events fired by ProtocolIOSession that implements client side of the HTTP/2 protocol negotiation handshake always forcing the choice of HTTP/2.
Since:
5.2
  • Constructor Details

  • Method Details

    • connected

      public void connected(IOSession session) throws IOException
      Description copied from interface: IOEventHandler
      Triggered after the given session has been just created.
      Parameters:
      session - the I/O session.
      Throws:
      IOException
    • outputReady

      public void outputReady(IOSession session) throws IOException
      Description copied from interface: IOEventHandler
      Triggered when the given session is ready for output.
      Parameters:
      session - the I/O session.
      Throws:
      IOException
    • inputReady

      public void inputReady(IOSession session, ByteBuffer src) throws IOException
      Description copied from interface: IOEventHandler
      Triggered when the given session has input pending.
      Parameters:
      session - the I/O session.
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • timeout

      public void timeout(IOSession session, Timeout timeout)
      Description copied from interface: IOEventHandler
      Triggered when the given session has timed out.
      Specified by:
      timeout in interface IOEventHandler
      Parameters:
      session - the I/O session.
      timeout - the timeout.
    • exception

      public void exception(IOSession session, Exception cause)
      Description copied from interface: IOEventHandler
      Triggered when the given session throws a exception.
      Specified by:
      exception in interface IOEventHandler
      Parameters:
      session - the I/O session.
    • disconnected

      public void disconnected(IOSession session)
      Description copied from interface: IOEventHandler
      Triggered when the given session has been terminated.
      Specified by:
      disconnected in interface IOEventHandler
      Parameters:
      session - the I/O session.
    • getSSLSession

      public SSLSession getSSLSession()
      Description copied from interface: HttpConnection
      Returns this connection's SSL session or null if TLS has not been activated.
      Specified by:
      getSSLSession in interface HttpConnection
      Returns:
      this connection's SSL session or null if TLS has not been activated.
    • getEndpointDetails

      public EndpointDetails getEndpointDetails()
      Description copied from interface: HttpConnection
      Returns this connection's endpoint details.
      Specified by:
      getEndpointDetails in interface HttpConnection
      Returns:
      this connection's endpoint details.
    • setSocketTimeout

      public void setSocketTimeout(Timeout timeout)
      Description copied from interface: SocketModalCloseable
      Sets the socket timeout value.
      Specified by:
      setSocketTimeout in interface SocketModalCloseable
      Parameters:
      timeout - timeout value
    • getSocketTimeout

      public Timeout getSocketTimeout()
      Description copied from interface: SocketModalCloseable
      Returns the socket timeout value.
      Specified by:
      getSocketTimeout in interface SocketModalCloseable
      Returns:
      timeout value.
    • getProtocolVersion

      public ProtocolVersion getProtocolVersion()
      Description copied from interface: HttpConnection
      Returns this connection's protocol version or null if unknown.
      Specified by:
      getProtocolVersion in interface HttpConnection
      Returns:
      this connection's protocol version or null if unknown.
    • getRemoteAddress

      public SocketAddress getRemoteAddress()
      Description copied from interface: HttpConnection
      Returns this connection's remote address or null if it is not connected yet or unconnected.
      Specified by:
      getRemoteAddress in interface HttpConnection
      Returns:
      this connection's remote address or null if it is not connected yet or unconnected.
    • getLocalAddress

      public SocketAddress getLocalAddress()
      Description copied from interface: HttpConnection
      Returns this connection's local address or null if it is not bound yet.
      Specified by:
      getLocalAddress in interface HttpConnection
      Returns:
      this connection's local address or null if it is not bound yet.
    • isOpen

      public boolean isOpen()
      Description copied from interface: HttpConnection
      Checks if this connection is open.
      Specified by:
      isOpen in interface HttpConnection
      Returns:
      true if it is open, false if it is closed.
    • close

      public void close() throws IOException
      Description copied from interface: HttpConnection
      Closes this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Use shutdown instead.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface HttpConnection
      Throws:
      IOException
    • close

      public void close(CloseMode closeMode)
      Description copied from interface: ModalCloseable
      Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.
      Specified by:
      close in interface ModalCloseable
      Parameters:
      closeMode - How to close the receiver.