Package io.vertx.rxjava3.core.http

## Class HttpConnection

- java.lang.Object
- - io.vertx.rxjava3.core.http.HttpConnection

- Direct Known Subclasses:
    `HttpClientConnection`

      public class HttpConnection
      extends Object

  Represents an HTTP connection.

  HTTP/1.x connection provides a limited implementation, the following methods are implemented:
  - `close()`
  - `closeHandler(io.vertx.core.Handler<java.lang.Void>)`
  - `exceptionHandler(io.vertx.core.Handler<java.lang.Throwable>)`

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<HttpConnection>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HttpConnection​(HttpConnection delegate)` |
    `HttpConnection​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Completable` | `close()` | Close immediately (`shutdown(0, TimeUnit.SECONDS`).
    `HttpConnection` | `closeHandler​(Handler<Void> handler)` | Set a close handler.
    `boolean` | `equals​(Object o)` |
    `HttpConnection` | `exceptionHandler​(Handler<Throwable> handler)` | Set an handler called when a connection error happens
    `HttpConnection` | `getDelegate()` |
    `int` | `getWindowSize()` |
    `HttpConnection` | `goAway​(long errorCode)` | Like `goAway(long)` with a last stream id `-1` which means to disallow any new stream creation.
    `HttpConnection` | `goAway​(long errorCode, int lastStreamId)` | Like `goAway(long)` with no buffer.
    `HttpConnection` | `goAway​(long errorCode, int lastStreamId, Buffer debugData)` | Send a go away frame to the remote endpoint of the connection.
    `HttpConnection` | `goAwayHandler​(Handler<GoAway> handler)` | Set an handler called when a frame is received.
    `int` | `hashCode()` |
    `String` | `indicatedServerName()` | Returns the SNI server name presented during the SSL handshake by the client.
    `boolean` | `isSsl()` |
    `SocketAddress` | `localAddress()` |
    `SocketAddress` | `localAddress​(boolean real)` | Like `localAddress()` ()} but returns the server local address when `real` is `true`
    `static HttpConnection` | `newInstance​(HttpConnection arg)` |
    `Single<Buffer>` | `ping​(Buffer data)` | Send a frame to the remote endpoint.
    `HttpConnection` | `pingHandler​(Handler<Buffer> handler)` | Set an handler notified when a frame is received from the remote endpoint.
    `SocketAddress` | `remoteAddress()` |
    `SocketAddress` | `remoteAddress​(boolean real)` | Like `remoteAddress()` but returns the proxy remote address when `real` is `true`
    `Http2Settings` | `remoteSettings()` |
    `HttpConnection` | `remoteSettingsHandler​(Handler<Http2Settings> handler)` | Set an handler that is called when remote endpoint `Http2Settings` are updated.
    `Completable` | `rxClose()` | Close immediately (`shutdown(0, TimeUnit.SECONDS`).
    `Single<Buffer>` | `rxPing​(Buffer data)` | Send a frame to the remote endpoint.
    `Completable` | `rxShutdown()` | Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
    `Completable` | `rxShutdown​(long timeout, TimeUnit unit)` | Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight requests are processed, otherwise after a `timeout` the connection will be closed.
    `Completable` | `rxUpdateSettings​(Http2Settings settings)` | Send to the remote endpoint an update of this endpoint settings
    `Http2Settings` | `settings()` |
    `HttpConnection` | `setWindowSize​(int windowSize)` | Update the current connection wide window size to a new size.
    `Completable` | `shutdown()` | Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
    `Completable` | `shutdown​(long timeout, TimeUnit unit)` | Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight requests are processed, otherwise after a `timeout` the connection will be closed.
    `HttpConnection` | `shutdownHandler​(Handler<Void> handler)` | Set a `handler` notified when the HTTP connection is shutdown: the client or server will close the connection within a certain amount of time.
    `SSLSession` | `sslSession()` |
    `String` | `toString()` |
    `Completable` | `updateSettings​(Http2Settings settings)` | Send to the remote endpoint an update of this endpoint settings

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

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

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<HttpConnection> __TYPE_ARG

  - ### Constructor Detail

    - #### HttpConnection

          public HttpConnection​(HttpConnection delegate)

    - #### HttpConnection

          public HttpConnection​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public HttpConnection getDelegate()

    - #### getWindowSize

          public int getWindowSize()

      Returns:
        the current connection window size or `-1` for HTTP/1.x

    - #### setWindowSize

          public HttpConnection setWindowSize​(int windowSize)

      Update the current connection wide window size to a new size.

      Increasing this value, gives better performance when several data streams are multiplexed

      This is not implemented for HTTP/1.x.
      Parameters:
        `windowSize` - the new window size
      Returns:
        a reference to this, so the API can be used fluently

    - #### goAway

          public HttpConnection goAway​(long errorCode)

      Like `goAway(long)` with a last stream id `-1` which means to disallow any new stream creation.
      Parameters:
        `errorCode` -
      Returns:

    - #### goAway

          public HttpConnection goAway​(long errorCode,
                                       int lastStreamId)

      Like `goAway(long)` with no buffer.
      Parameters:
        `errorCode` -
        `lastStreamId` -
      Returns:

    - #### goAway

          public HttpConnection goAway​(long errorCode,
                                       int lastStreamId,
                                       Buffer debugData)

      Send a go away frame to the remote endpoint of the connection.

      - a frame is sent to the to the remote endpoint with the `errorCode` and `debugData`
      - any stream created after the stream identified by `lastStreamId` will be closed
      - for an is different than `0` when all the remaining streams are closed this connection will be closed automatically

      This is not implemented for HTTP/1.x.
      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​(Handler<GoAway> handler)

      Set an handler called when a frame is received.

      This is not implemented for HTTP/1.x.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### shutdownHandler

          public HttpConnection shutdownHandler​(Handler<Void> handler)

      Set a `handler` notified when the HTTP connection is shutdown: the client or server will close the connection within a certain amount of time. This gives the opportunity to the `handler` to close the current requests in progress gracefully before the HTTP connection is forcefully closed.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### shutdown

          public Completable shutdown()

      Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
      Returns:
        a future completed when shutdown has completed

    - #### rxShutdown

          public Completable rxShutdown()

      Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
      Returns:
        a future completed when shutdown has completed

    - #### shutdown

          public Completable shutdown​(long timeout,
                                      TimeUnit unit)

      Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight requests are processed, otherwise after a `timeout` 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 connection will be closed.
      Parameters:
        `timeout` - the amount of time after which all resources are forcibly closed
        `unit` - the of the timeout
      Returns:
        a future completed when shutdown has completed

    - #### rxShutdown

          public Completable rxShutdown​(long timeout,
                                        TimeUnit unit)

      Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight requests are processed, otherwise after a `timeout` 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 connection will be closed.
      Parameters:
        `timeout` - the amount of time after which all resources are forcibly closed
        `unit` - the of the timeout
      Returns:
        a future completed when shutdown has completed

    - #### closeHandler

          public HttpConnection closeHandler​(Handler<Void> handler)

      Set a close handler. The handler will get notified when the connection is closed.
      Parameters:
        `handler` - the handler to be notified
      Returns:
        a reference to this, so the API can be used fluently

    - #### close

          public Completable close()

      Close immediately (`shutdown(0, TimeUnit.SECONDS`).
      Returns:
        a future notified when the client is closed

    - #### rxClose

          public Completable rxClose()

      Close immediately (`shutdown(0, TimeUnit.SECONDS`).
      Returns:
        a future notified when the client is closed

    - #### settings

          public Http2Settings settings()

      Returns:
        the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x

    - #### updateSettings

          public Completable updateSettings​(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.
      Parameters:
        `settings` - the new settings
      Returns:
        a future completed when the settings have been acknowledged by the remote endpoint

    - #### rxUpdateSettings

          public Completable rxUpdateSettings​(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.
      Parameters:
        `settings` - the new settings
      Returns:
        a future completed when the settings have been acknowledged by the remote endpoint

    - #### remoteSettings

          public Http2Settings remoteSettings()

      Returns:
        the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x

    - #### remoteSettingsHandler

          public HttpConnection remoteSettingsHandler​(Handler<Http2Settings> handler)

      Set an handler that is called when remote endpoint `Http2Settings` are updated.

      This is not implemented for HTTP/1.x.
      Parameters:
        `handler` - the handler for remote endpoint settings
      Returns:
        a reference to this, so the API can be used fluently

    - #### ping

          public Single<Buffer> ping​(Buffer data)

      Send a frame to the remote endpoint.

      This is not implemented for HTTP/1.x.
      Parameters:
        `data` - the 8 bytes data of the frame
      Returns:
        a future notified with the pong reply or the failure

    - #### rxPing

          public Single<Buffer> rxPing​(Buffer data)

      Send a frame to the remote endpoint.

      This is not implemented for HTTP/1.x.
      Parameters:
        `data` - the 8 bytes data of the frame
      Returns:
        a future notified with the pong reply or the failure

    - #### pingHandler

          public HttpConnection pingHandler​(Handler<Buffer> handler)

      Set an handler notified when a frame is received from the remote endpoint.

      This is not implemented for HTTP/1.x.
      Parameters:
        `handler` - the handler to be called when a is received
      Returns:
        a reference to this, so the API can be used fluently

    - #### exceptionHandler

          public HttpConnection exceptionHandler​(Handler<Throwable> handler)

      Set an handler called when a connection error happens
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

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

    - #### remoteAddress

          public SocketAddress remoteAddress​(boolean real)

      Like `remoteAddress()` but returns the proxy remote address when `real` is `true`
      Parameters:
        `real` -
      Returns:

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

    - #### localAddress

          public SocketAddress localAddress​(boolean real)

      Like `localAddress()` ()} but returns the server local address when `real` is `true`
      Parameters:
        `real` -
      Returns:

    - #### isSsl

          public boolean isSsl()

      Returns:
        true if this `HttpConnection` is encrypted via SSL/TLS.

    - #### indicatedServerName

          public String indicatedServerName()

      Returns the SNI server name presented during the SSL handshake by the client.
      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​(HttpConnection arg)