Class HttpConnection

    • Constructor Detail

      • HttpConnection

        public HttpConnection​(io.vertx.core.http.HttpConnection delegate)
      • HttpConnection

        public HttpConnection​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.core.http.HttpConnection getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getWindowSize

        public int getWindowSize()
        Returns:
        the current connection window size or -1 for HTTP/1.x
      • setWindowSize

        public HttpConnection setWindowSize​(int windowSize)
        Parameters:
        windowSize - the new window size
        Returns:
        a reference to this, so the API can be used fluently
      • goAway

        public HttpConnection goAway​(long errorCode)
        Parameters:
        errorCode -
        Returns:
        the instance of HttpConnection to chain method calls.
      • goAway

        public HttpConnection goAway​(long errorCode,
                                     int lastStreamId)
        Parameters:
        errorCode -
        lastStreamId -
        Returns:
        the instance of HttpConnection to chain method calls.
      • goAway

        public HttpConnection goAway​(long errorCode,
                                     int lastStreamId,
                                     Buffer debugData)
        Parameters:
        errorCode - the error code
        lastStreamId - the last stream id
        debugData - additional debug data sent to the remote endpoint
        Returns:
        a reference to this, so the API can be used fluently
      • goAwayHandler

        public HttpConnection goAwayHandler​(Consumer<io.vertx.core.http.GoAway> handler)
        Parameters:
        handler - the handler
        Returns:
      • shutdownHandler

        public HttpConnection shutdownHandler​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • shutdown

        public io.smallrye.mutiny.Uni<Void> shutdown()
        Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed. Client connection are immediately removed from the pool.
        • HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
        • HTTP/1.x client connection supports this feature
        • HTTP/1.x server connections do not support this feature

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • shutdownAndAwait

        public Void shutdownAndAwait()
        Blocking variant of shutdown().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • shutdownAndForget

        public void shutdownAndForget()
        Variant of shutdown() that ignores the result of the operation.

        This method subscribes on the result of shutdown(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from shutdown() but you don't need to compose it with other operations.

      • shutdown

        public io.smallrye.mutiny.Uni<Void> shutdown​(long timeout)
        Like shutdown() but with a specific timeout in milliseconds.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        timeout -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • shutdownAndAwait

        public Void shutdownAndAwait​(long timeout)
        Blocking variant of shutdown(long).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        timeout -
        Returns:
        the Void instance produced by the operation.
      • shutdownAndForget

        public void shutdownAndForget​(long timeout)
        Variant of shutdown(long) that ignores the result of the operation.

        This method subscribes on the result of shutdown(long), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from shutdown(long) but you don't need to compose it with other operations.

        Parameters:
        timeout -
      • closeHandler

        public HttpConnection closeHandler​(Runnable handler)
        Parameters:
        handler - the handler to be notified
        Returns:
      • close

        public io.smallrye.mutiny.Uni<Void> close()
        Close the connection and all the currently active streams.

        An HTTP/2 connection will send a frame before.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait()
        Blocking variant of close().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        public void closeAndForget()
        Variant of close() that ignores the result of the operation.

        This method subscribes on the result of close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from close() but you don't need to compose it with other operations.

      • settings

        public io.vertx.core.http.Http2Settings settings()
        Returns:
        the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x
      • updateSettings

        public io.smallrye.mutiny.Uni<Void> updateSettings​(io.vertx.core.http.Http2Settings settings)
        Send to the remote endpoint an update of this endpoint settings

        The completionHandler will be notified when the remote endpoint has acknowledged the settings.

        This is not implemented for HTTP/1.x.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        settings - the new settings
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateSettingsAndAwait

        public Void updateSettingsAndAwait​(io.vertx.core.http.Http2Settings settings)
        Blocking variant of updateSettings(Http2Settings).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        settings - the new settings
        Returns:
        the Void instance produced by the operation.
      • updateSettingsAndForget

        public HttpConnection updateSettingsAndForget​(io.vertx.core.http.Http2Settings settings)
        Variant of updateSettings(Http2Settings) that ignores the result of the operation.

        This method subscribes on the result of updateSettings(Http2Settings), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from updateSettings(Http2Settings) but you don't need to compose it with other operations.

        Parameters:
        settings - the new settings
        Returns:
        the instance of HttpConnection to chain method calls.
      • remoteSettings

        public io.vertx.core.http.Http2Settings remoteSettings()
        Returns:
        the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x
      • remoteSettingsHandler

        public HttpConnection remoteSettingsHandler​(Consumer<io.vertx.core.http.Http2Settings> handler)
        Parameters:
        handler - the handler for remote endpoint settings
        Returns:
      • ping

        public io.smallrye.mutiny.Uni<Buffer> ping​(Buffer data)
        Send a frame to the remote endpoint.

        This is not implemented for HTTP/1.x.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        data - the 8 bytes data of the frame
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • pingAndAwait

        public Buffer pingAndAwait​(Buffer data)
        Blocking variant of ping(io.vertx.mutiny.core.buffer.Buffer).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        data - the 8 bytes data of the frame
        Returns:
        the Buffer instance produced by the operation.
      • pingHandler

        public HttpConnection pingHandler​(Consumer<Buffer> handler)
        Parameters:
        handler - the handler to be called when a is received
        Returns:
      • remoteAddress

        public SocketAddress remoteAddress()
        Returns:
        the remote address for this connection, possibly null (e.g a server bound on a domain socket). If useProxyProtocol is set to true, the address returned will be of the actual connecting client.
      • localAddress

        public SocketAddress localAddress()
        Returns:
        the local address for this connection, possibly null (e.g a server bound on a domain socket) If useProxyProtocol is set to true, the address returned will be of the proxy.
      • isSsl

        public boolean isSsl()
        Returns:
        true if this HttpConnection is encrypted via SSL/TLS.
      • indicatedServerName

        public String indicatedServerName()
        Returns:
        the indicated server name
      • sslSession

        public SSLSession sslSession()
        Returns:
        SSLSession associated with the underlying socket. Returns null if connection is not SSL.
      • newInstance

        public static HttpConnection newInstance​(io.vertx.core.http.HttpConnection arg)