Package io.vertx.reactivex.core.net

## Class NetServer

- java.lang.Object
- - io.vertx.reactivex.core.net.NetServer

- All Implemented Interfaces:
    `Measured`

      public class NetServer
      extends Object
      implements Measured

  Represents a TCP server

  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<NetServer>` | `__TYPE_ARG` |

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `actualPort()` | The actual port the server is listening on.
    `Future<Void>` | `close()` | Close the server.
    `NetServer` | `connectHandler​(Handler<NetSocket> handler)` | Supply a connect handler for this server.
    `boolean` | `equals​(Object o)` |
    `NetServer` | `getDelegate()` |
    `int` | `hashCode()` |
    `boolean` | `isMetricsEnabled()` | Whether the metrics are enabled for this measured object
    `Future<NetServer>` | `listen()` | Start listening on the port and host as configured in the `NetServerOptions` used when creating the server.
    `Future<NetServer>` | `listen​(int port)` | Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the `NetServerOptions` used when creating the server.
    `Future<NetServer>` | `listen​(int port, String host)` | Start listening on the specified port and host, ignoring port and host configured in the `NetServerOptions` used when creating the server.
    `Future<NetServer>` | `listen​(SocketAddress localAddress)` | Start listening on the specified local address, ignoring port and host configured in the `NetServerOptions` used when creating the server.
    `static NetServer` | `newInstance​(NetServer arg)` |
    `Completable` | `rxClose()` | Close the server.
    `Single<NetServer>` | `rxListen()` | Start listening on the port and host as configured in the `NetServerOptions` used when creating the server.
    `Single<NetServer>` | `rxListen​(int port)` | Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the `NetServerOptions` used when creating the server.
    `Single<NetServer>` | `rxListen​(int port, String host)` | Start listening on the specified port and host, ignoring port and host configured in the `NetServerOptions` used when creating the server.
    `Single<NetServer>` | `rxListen​(SocketAddress localAddress)` | Start listening on the specified local address, ignoring port and host configured in the `NetServerOptions` used when creating the server.
    `Completable` | `rxShutdown()` | Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
    `Completable` | `rxShutdown​(long timeout, TimeUnit unit)` | Initiate the server shutdown sequence.
    `Single<Boolean>` | `rxUpdateSSLOptions​(ServerSSLOptions options)` | Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Single<Boolean>` | `rxUpdateSSLOptions​(ServerSSLOptions options, boolean force)` | Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Future<Void>` | `shutdown()` | Shutdown with a 30 seconds timeout (`shutdown(30, TimeUnit.SECONDS)`).
    `Future<Void>` | `shutdown​(long timeout, TimeUnit unit)` | Initiate the server shutdown sequence.
    `String` | `toString()` |
    `Future<Boolean>` | `updateSSLOptions​(ServerSSLOptions options)` | Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Future<Boolean>` | `updateSSLOptions​(ServerSSLOptions options, boolean force)` | Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `void` | `updateTrafficShapingOptions​(TrafficShapingOptions options)` | Update traffic shaping options `options`, the update happens if valid values are passed for traffic shaping options.

    - ### 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<NetServer> __TYPE_ARG

  - ### Constructor Detail

    - #### NetServer

          public NetServer​(NetServer delegate)

    - #### NetServer

          public NetServer​(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 NetServer getDelegate()

      Specified by:
        `getDelegate` in interface `Measured`

    - #### isMetricsEnabled

          public boolean isMetricsEnabled()

      Whether the metrics are enabled for this measured object
      Specified by:
        `isMetricsEnabled` in interface `Measured`
      Returns:
        `true` if metrics are enabled

    - #### connectHandler

          public NetServer connectHandler​(Handler<NetSocket> handler)

      Supply a connect handler for this server. The server can only have at most one connect handler at any one time. As the server accepts TCP or SSL connections it creates an instance of `NetSocket` and passes it to the connect handler.
      Parameters:
        `handler` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### listen

          public Future<NetServer> listen()

      Start listening on the port and host as configured in the `NetServerOptions` used when creating the server.

      The server may not be listening until some time after the call to listen has returned.

      Returns:
        a future completed with the listen operation result

    - #### rxListen

          public Single<NetServer> rxListen()

      Start listening on the port and host as configured in the `NetServerOptions` used when creating the server.

      The server may not be listening until some time after the call to listen has returned.

      Returns:
        a future completed with the listen operation result

    - #### listen

          public Future<NetServer> listen​(int port,
                                          String host)

      Start listening on the specified port and host, ignoring port and host configured in the `NetServerOptions` used when creating the server.

      Port `0` can be specified meaning "choose an random port".

      Host `0.0.0.0` can be specified meaning "listen on all available interfaces".

      The server may not be listening until some time after the call to listen has returned.

      Parameters:
        `port` -
        `host` -
      Returns:
        a future completed with the listen operation result

    - #### rxListen

          public Single<NetServer> rxListen​(int port,
                                            String host)

      Start listening on the specified port and host, ignoring port and host configured in the `NetServerOptions` used when creating the server.

      Port `0` can be specified meaning "choose an random port".

      Host `0.0.0.0` can be specified meaning "listen on all available interfaces".

      The server may not be listening until some time after the call to listen has returned.

      Parameters:
        `port` -
        `host` -
      Returns:
        a future completed with the listen operation result

    - #### listen

          public Future<NetServer> listen​(int port)

      Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the `NetServerOptions` used when creating the server.

      Port `0` can be specified meaning "choose an random port".

      The server may not be listening until some time after the call to listen has returned.

      Parameters:
        `port` -
      Returns:
        a future completed with the listen operation result

    - #### rxListen

          public Single<NetServer> rxListen​(int port)

      Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the `NetServerOptions` used when creating the server.

      Port `0` can be specified meaning "choose an random port".

      The server may not be listening until some time after the call to listen has returned.

      Parameters:
        `port` -
      Returns:
        a future completed with the listen operation result

    - #### listen

          public Future<NetServer> listen​(SocketAddress localAddress)

      Start listening on the specified local address, ignoring port and host configured in the `NetServerOptions` used when creating the server.

      The server may not be listening until some time after the call to listen has returned.

      Parameters:
        `localAddress` - the local address to listen on
      Returns:
        a future completed with the listen operation result

    - #### rxListen

          public Single<NetServer> rxListen​(SocketAddress localAddress)

      Start listening on the specified local address, ignoring port and host configured in the `NetServerOptions` used when creating the server.

      The server may not be listening until some time after the call to listen has returned.

      Parameters:
        `localAddress` - the local address to listen on
      Returns:
        a future completed with the listen operation result

    - #### close

          public Future<Void> close()

      Close the server. This will close any currently open connections. The close may not complete until after this method has returned.
      Returns:
        a future completed with the listen operation result

    - #### rxClose

          public Completable rxClose()

      Close the server. This will close any currently open connections. The close may not complete until after this method has returned.
      Returns:
        a future completed with the listen operation result

    - #### shutdown

          public Future<Void> 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 Future<Void> shutdown​(long timeout,
                                       TimeUnit unit)

      Initiate the server shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through `NetSocket.shutdownHandler(io.vertx.core.Handler<java.lang.Void>)`. When all connections are closed the client is closed. When the `timeout` expires, all unclosed connections are immediately closed.

      Parameters:
        `timeout` - the amount of time after which all resources are forcibly closed
        `unit` - the of the timeout
      Returns:
        a future notified when the client is closed

    - #### rxShutdown

          public Completable rxShutdown​(long timeout,
                                        TimeUnit unit)

      Initiate the server shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through `NetSocket.shutdownHandler(io.vertx.core.Handler<java.lang.Void>)`. When all connections are closed the client is closed. When the `timeout` expires, all unclosed connections are immediately closed.

      Parameters:
        `timeout` - the amount of time after which all resources are forcibly closed
        `unit` - the of the timeout
      Returns:
        a future notified when the client is closed

    - #### actualPort

          public int actualPort()

      The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port
      Returns:
        the actual port the server is listening on.

    - #### updateSSLOptions

          public Future<Boolean> updateSSLOptions​(ServerSSLOptions options)

      Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
      Returns:
        a future signaling the update success

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions​(ServerSSLOptions options)

      Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
      Returns:
        a future signaling the update success

    - #### updateSSLOptions

          public Future<Boolean> updateSSLOptions​(ServerSSLOptions options,
                                                  boolean force)

      Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The `options` object is compared using its `equals` method against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, setting `force` to `true` forces the update.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:
        a future signaling the update success

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions​(ServerSSLOptions options,
                                                    boolean force)

      Update the server with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The `options` object is compared using its `equals` method against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, setting `force` to `true` forces the update.

      The boolean succeeded future result indicates whether the update occurred.

      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:
        a future signaling the update success

    - #### updateTrafficShapingOptions

          public void updateTrafficShapingOptions​(TrafficShapingOptions options)

      Update traffic shaping options `options`, the update happens if valid values are passed for traffic shaping options. This update happens synchronously and at best effort for rate update to take effect immediately.
      Parameters:
        `options` - the new traffic shaping options

    - #### newInstance

          public static NetServer newInstance​(NetServer arg)