Class Http2ClientConnection

  • All Implemented Interfaces:
    ClientConnection, java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel

    public class Http2ClientConnection
    extends java.lang.Object
    implements ClientConnection
    Author:
    Stuart Douglas
    • Method Detail

      • sendRequest

        public void sendRequest​(ClientRequest request,
                                ClientCallback<ClientExchange> clientCallback)
        Description copied from interface: ClientConnection
        Sends a client request. The request object should not be modified after it has been submitted to the connection.

        Request objects can be queued. Once the request is in a state that it is ready to be sent the clientCallback is invoked to provide the caller with the ClientExchange

        If ClientConnection.isMultiplexingSupported() returns true then multiple requests may be active at the same time, and a later request may complete before an earlier one.

        Note that the request header may not be written out until after the callback has been invoked. This allows the client to write out a header with a gathering write if the request contains content.

        Specified by:
        sendRequest in interface ClientConnection
        Parameters:
        request - The request to send.
      • performUpgrade

        public org.xnio.StreamConnection performUpgrade()
                                                 throws java.io.IOException
        Description copied from interface: ClientConnection
        Upgrade the connection, if the underlying protocol supports it. This should only be called after an upgrade request has been submitted and the target server has accepted the upgrade.
        Specified by:
        performUpgrade in interface ClientConnection
        Returns:
        The resulting StreamConnection
        Throws:
        java.io.IOException
      • getPeerAddress

        public <A extends java.net.SocketAddress> A getPeerAddress​(java.lang.Class<A> type)
        Specified by:
        getPeerAddress in interface ClientConnection
      • getLocalAddress

        public <A extends java.net.SocketAddress> A getLocalAddress​(java.lang.Class<A> type)
        Specified by:
        getLocalAddress in interface ClientConnection
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
        Specified by:
        isOpen in interface ClientConnection
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getOption

        public <T> T getOption​(org.xnio.Option<T> option)
                        throws java.io.IOException
        Specified by:
        getOption in interface ClientConnection
        Throws:
        java.io.IOException
      • setOption

        public <T> T setOption​(org.xnio.Option<T> option,
                               T value)
                        throws java.lang.IllegalArgumentException,
                               java.io.IOException
        Specified by:
        setOption in interface ClientConnection
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException
      • isPushSupported

        public boolean isPushSupported()
        Specified by:
        isPushSupported in interface ClientConnection
        Returns:
        true if this connection support server push
      • addCloseListener

        public void addCloseListener​(org.xnio.ChannelListener<ClientConnection> listener)
        Description copied from interface: ClientConnection
        Adds a close listener, than will be invoked with the connection is closed
        Specified by:
        addCloseListener in interface ClientConnection
        Parameters:
        listener - The close listener