org.apache.hc.core5.http2.impl.nio

## Class ServerH2PrefaceHandler

- java.lang.Object
- - org.apache.hc.core5.http2.impl.nio.ServerH2PrefaceHandler

- All Implemented Interfaces:
    Closeable, AutoCloseable, HttpConnection, HttpConnectionEventHandler, SocketModalCloseable, ModalCloseable, IOEventHandler

      @Internal
      public class ServerH2PrefaceHandler
      extends Object

  I/O event handler for events fired by `ProtocolIOSession` that implements server side of the HTTP/2 protocol negotiation handshake.
  Since:
    5.2

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerH2PrefaceHandler(ProtocolIOSession ioSession, ServerH2StreamMultiplexerFactory http2StreamHandlerFactory)`
    `ServerH2PrefaceHandler(ProtocolIOSession ioSession, ServerH2StreamMultiplexerFactory http2StreamHandlerFactory, FutureCallback<ProtocolIOSession> resultCallback)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes this connection gracefully.
    `void` | `close(CloseMode closeMode)` Closes this process or endpoint and releases any system resources associated with it.
    `void` | `connected(IOSession session)` Triggered after the given session has been just created.
    `void` | `disconnected(IOSession session)` Triggered when the given session has been terminated.
    `void` | `exception(IOSession session, Exception cause)` Triggered when the given session throws a exception.
    `EndpointDetails` | `getEndpointDetails()` Returns this connection's endpoint details.
    `SocketAddress` | `getLocalAddress()` Returns this connection's local address or `null` if it is not bound yet.
    `ProtocolVersion` | `getProtocolVersion()` Returns this connection's protocol version or `null` if unknown.
    `SocketAddress` | `getRemoteAddress()` Returns this connection's remote address or `null` if it is not connected yet or unconnected.
    `Timeout` | `getSocketTimeout()` Returns the socket timeout value.
    `SSLSession` | `getSSLSession()` Returns this connection's SSL session or `null` if TLS has not been activated.
    `void` | `inputReady(IOSession session, ByteBuffer src)` Triggered when the given session has input pending.
    `boolean` | `isOpen()` Checks if this connection is open.
    `void` | `outputReady(IOSession session)` Triggered when the given session is ready for output.
    `void` | `setSocketTimeout(Timeout timeout)` Sets the socket timeout value.
    `void` | `timeout(IOSession session, Timeout timeout)` Triggered when the given session has timed out.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### ServerH2PrefaceHandler

          public ServerH2PrefaceHandler(ProtocolIOSession ioSession,
                                        ServerH2StreamMultiplexerFactory http2StreamHandlerFactory)

    - #### ServerH2PrefaceHandler

          public ServerH2PrefaceHandler(ProtocolIOSession ioSession,
                                        ServerH2StreamMultiplexerFactory http2StreamHandlerFactory,
                                        FutureCallback<ProtocolIOSession> resultCallback)

  - ### Method Detail

    - #### 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`

    - #### 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`

    - #### 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`

    - #### 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 `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      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.

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