Class NetClient

java.lang.Object
io.vertx.rxjava3.core.net.NetClient
All Implemented Interfaces:
RxDelegate, Measured

public class NetClient extends Object implements RxDelegate, Measured
A TCP client.

Multiple connections to different servers can be made using the same instance.

This client supports a configurable number of connection attempts and a configurable delay between attempts.

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 final TypeArg<NetClient>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NetClient(NetClient delegate)
     
    NetClient(Object delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.reactivex.rxjava3.core.Completable
    Close immediately (shutdown(0, TimeUnit.SECONDS).
    io.reactivex.rxjava3.core.Single<NetSocket>
    connect(int port, String host)
    Open a connection to a server at the specific port and host.
    io.reactivex.rxjava3.core.Single<NetSocket>
    connect(int port, String host, String serverName)
    Open a connection to a server at the specific port and host.
    io.reactivex.rxjava3.core.Single<NetSocket>
    connect(ConnectOptions connectOptions)
    Open a connection to a server at the specific connectOptions.
    io.reactivex.rxjava3.core.Single<NetSocket>
    connect(SocketAddress remoteAddress)
    Open a connection to a server at the specific remoteAddress.
    io.reactivex.rxjava3.core.Single<NetSocket>
    connect(SocketAddress remoteAddress, String serverName)
    Open a connection to a server at the specific remoteAddress.
    boolean
     
     
    int
     
    boolean
    Whether the metrics are enabled for this measured object
    static NetClient
     
    io.reactivex.rxjava3.core.Completable
    Close immediately (shutdown(0, TimeUnit.SECONDS).
    io.reactivex.rxjava3.core.Single<NetSocket>
    rxConnect(int port, String host)
    Open a connection to a server at the specific port and host.
    io.reactivex.rxjava3.core.Single<NetSocket>
    rxConnect(int port, String host, String serverName)
    Open a connection to a server at the specific port and host.
    io.reactivex.rxjava3.core.Single<NetSocket>
    rxConnect(ConnectOptions connectOptions)
    Open a connection to a server at the specific connectOptions.
    io.reactivex.rxjava3.core.Single<NetSocket>
    rxConnect(SocketAddress remoteAddress)
    Open a connection to a server at the specific remoteAddress.
    io.reactivex.rxjava3.core.Single<NetSocket>
    rxConnect(SocketAddress remoteAddress, String serverName)
    Open a connection to a server at the specific remoteAddress.
    io.reactivex.rxjava3.core.Completable
    Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
    io.reactivex.rxjava3.core.Completable
    rxShutdown(long timeout, TimeUnit unit)
    Calls shutdown().
    io.reactivex.rxjava3.core.Completable
    Initiate the client shutdown sequence.
    io.reactivex.rxjava3.core.Single<Boolean>
    Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.
    io.reactivex.rxjava3.core.Single<Boolean>
    rxUpdateSSLOptions(ClientSSLOptions options, boolean force)
    Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.
    io.reactivex.rxjava3.core.Completable
    Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
    io.reactivex.rxjava3.core.Completable
    shutdown(long timeout, TimeUnit unit)
    Calls shutdown().
    io.reactivex.rxjava3.core.Completable
    shutdown(Duration timeout)
    Initiate the client shutdown sequence.
     
    io.reactivex.rxjava3.core.Single<Boolean>
    Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.
    io.reactivex.rxjava3.core.Single<Boolean>
    updateSSLOptions(ClientSSLOptions options, boolean force)
    Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • NetClient

      public NetClient(NetClient delegate)
    • NetClient

      public NetClient(Object delegate)
  • Method Details

    • 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 NetClient getDelegate()
      Specified by:
      getDelegate in interface Measured
      Specified by:
      getDelegate in interface RxDelegate
    • 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
    • connect

      public io.reactivex.rxjava3.core.Single<NetSocket> connect(int port, String host)
      Open a connection to a server at the specific port and host.

      host can be a valid host name or IP address.

      Parameters:
      port - the port
      host - the host
      Returns:
      a future notified when the socket is connected
    • rxConnect

      public io.reactivex.rxjava3.core.Single<NetSocket> rxConnect(int port, String host)
      Open a connection to a server at the specific port and host.

      host can be a valid host name or IP address.

      Parameters:
      port - the port
      host - the host
      Returns:
      a future notified when the socket is connected
    • connect

      public io.reactivex.rxjava3.core.Single<NetSocket> connect(int port, String host, String serverName)
      Open a connection to a server at the specific port and host.

      host can be a valid host name or IP address.

      Parameters:
      port - the port
      host - the host
      serverName - the SNI server name
      Returns:
      a future notified when the socket is connected
    • rxConnect

      public io.reactivex.rxjava3.core.Single<NetSocket> rxConnect(int port, String host, String serverName)
      Open a connection to a server at the specific port and host.

      host can be a valid host name or IP address.

      Parameters:
      port - the port
      host - the host
      serverName - the SNI server name
      Returns:
      a future notified when the socket is connected
    • connect

      public io.reactivex.rxjava3.core.Single<NetSocket> connect(SocketAddress remoteAddress)
      Open a connection to a server at the specific remoteAddress.
      Parameters:
      remoteAddress - the remote address
      Returns:
      a future notified when the socket is connected
    • rxConnect

      public io.reactivex.rxjava3.core.Single<NetSocket> rxConnect(SocketAddress remoteAddress)
      Open a connection to a server at the specific remoteAddress.
      Parameters:
      remoteAddress - the remote address
      Returns:
      a future notified when the socket is connected
    • connect

      public io.reactivex.rxjava3.core.Single<NetSocket> connect(SocketAddress remoteAddress, String serverName)
      Open a connection to a server at the specific remoteAddress.
      Parameters:
      remoteAddress - the remote address
      serverName - the SNI server name
      Returns:
      a future notified when the socket is connected
    • rxConnect

      public io.reactivex.rxjava3.core.Single<NetSocket> rxConnect(SocketAddress remoteAddress, String serverName)
      Open a connection to a server at the specific remoteAddress.
      Parameters:
      remoteAddress - the remote address
      serverName - the SNI server name
      Returns:
      a future notified when the socket is connected
    • connect

      public io.reactivex.rxjava3.core.Single<NetSocket> connect(ConnectOptions connectOptions)
      Open a connection to a server at the specific connectOptions.
      Parameters:
      connectOptions - the options describing how to connect to the remote server
      Returns:
      a future notified when the socket is connected
    • rxConnect

      public io.reactivex.rxjava3.core.Single<NetSocket> rxConnect(ConnectOptions connectOptions)
      Open a connection to a server at the specific connectOptions.
      Parameters:
      connectOptions - the options describing how to connect to the remote server
      Returns:
      a future notified when the socket is connected
    • close

      public io.reactivex.rxjava3.core.Completable close()
      Close immediately (shutdown(0, TimeUnit.SECONDS).
      Returns:
      a future notified when the client is closed
    • rxClose

      public io.reactivex.rxjava3.core.Completable rxClose()
      Close immediately (shutdown(0, TimeUnit.SECONDS).
      Returns:
      a future notified when the client is closed
    • shutdown

      public io.reactivex.rxjava3.core.Completable shutdown()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
      Returns:
      a future completed when shutdown has completed
    • rxShutdown

      public io.reactivex.rxjava3.core.Completable rxShutdown()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
      Returns:
      a future completed when shutdown has completed
    • shutdown

      public io.reactivex.rxjava3.core.Completable shutdown(long timeout, TimeUnit unit)
      Calls shutdown().
      Parameters:
      timeout -
      unit -
      Returns:
    • rxShutdown

      public io.reactivex.rxjava3.core.Completable rxShutdown(long timeout, TimeUnit unit)
      Calls shutdown().
      Parameters:
      timeout -
      unit -
      Returns:
    • updateSSLOptions

      public io.reactivex.rxjava3.core.Single<Boolean> updateSSLOptions(ClientSSLOptions options)

      Update the client 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 io.reactivex.rxjava3.core.Single<Boolean> rxUpdateSSLOptions(ClientSSLOptions options)

      Update the client 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 io.reactivex.rxjava3.core.Single<Boolean> updateSSLOptions(ClientSSLOptions options, boolean force)

      Update the client 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 io.reactivex.rxjava3.core.Single<Boolean> rxUpdateSSLOptions(ClientSSLOptions options, boolean force)

      Update the client 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
    • shutdown

      public io.reactivex.rxjava3.core.Completable shutdown(Duration timeout)
      Initiate the client shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through NetSocket.shutdownHandler(io.vertx.core.Handler<java.time.Duration>). 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
      Returns:
      a future notified when the client is closed
    • rxShutdown

      public io.reactivex.rxjava3.core.Completable rxShutdown(Duration timeout)
      Initiate the client shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through NetSocket.shutdownHandler(io.vertx.core.Handler<java.time.Duration>). 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
      Returns:
      a future notified when the client is closed
    • newInstance

      public static NetClient newInstance(NetClient arg)