Class NetClient

java.lang.Object
io.vertx.mutiny.core.net.NetClient
All Implemented Interfaces:
MutinyDelegate, Measured

public class NetClient extends Object implements Measured, MutinyDelegate
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 Mutiny-ified interface.

Author:
Tim Fox
See Also:
  • NetClient
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.vertx.mutiny.core.metrics.Measured

    Measured.MeasuredImpl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TypeArg<NetClient>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NetClient(io.vertx.core.net.NetClient delegate)
    Create a new instance of NetClient delegating to the given (non-null) instance of NetClient.
    NetClient(Object delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.smallrye.mutiny.Uni<Void>
    Close immediately (shutdown(0, TimeUnit.SECONDS).
    void
    Close immediately (shutdown(0, TimeUnit.SECONDS).
    Close immediately (shutdown(0, TimeUnit.SECONDS).
    io.smallrye.mutiny.Uni<NetSocket>
    connect(int port, String host)
    Open a connection to a server at the specific port and host.
    io.smallrye.mutiny.Uni<NetSocket>
    connect(int port, String host, String serverName)
    Open a connection to a server at the specific port and host.
    io.smallrye.mutiny.Uni<NetSocket>
    connect(io.vertx.core.net.ConnectOptions connectOptions)
    Open a connection to a server at the specific connectOptions.
    io.smallrye.mutiny.Uni<NetSocket>
    connect(io.vertx.core.net.SocketAddress remoteAddress)
    Open a connection to a server at the specific remoteAddress.
    io.smallrye.mutiny.Uni<NetSocket>
    connect(io.vertx.core.net.SocketAddress remoteAddress, String serverName)
    Open a connection to a server at the specific remoteAddress.
    connectAndAwait(int port, String host)
    Open a connection to a server at the specific port and host.
    connectAndAwait(int port, String host, String serverName)
    Open a connection to a server at the specific port and host.
    connectAndAwait(io.vertx.core.net.ConnectOptions connectOptions)
    Open a connection to a server at the specific connectOptions.
    connectAndAwait(io.vertx.core.net.SocketAddress remoteAddress)
    Open a connection to a server at the specific remoteAddress.
    connectAndAwait(io.vertx.core.net.SocketAddress remoteAddress, String serverName)
    Open a connection to a server at the specific remoteAddress.
    connectAndForget(int port, String host)
    Open a connection to a server at the specific port and host.
    connectAndForget(int port, String host, String serverName)
    Open a connection to a server at the specific port and host.
    connectAndForget(io.vertx.core.net.ConnectOptions connectOptions)
    Open a connection to a server at the specific connectOptions.
    connectAndForget(io.vertx.core.net.SocketAddress remoteAddress)
    Open a connection to a server at the specific remoteAddress.
    connectAndForget(io.vertx.core.net.SocketAddress remoteAddress, String serverName)
    Open a connection to a server at the specific remoteAddress.
    boolean
     
    io.vertx.core.net.NetClient
    Get the delegate instance.
    int
     
    boolean
    Whether the metrics are enabled for this measured object
    static NetClient
    newInstance(io.vertx.core.net.NetClient delegate)
    Creates a new instance of the NetClient.
    io.smallrye.mutiny.Uni<Void>
    Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
    io.smallrye.mutiny.Uni<Void>
    shutdown(long timeout, TimeUnit unit)
    io.smallrye.mutiny.Uni<Void>
    shutdown(Duration timeout)
    Initiate the client shutdown sequence.
    void
    Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
    void
    shutdownAndAwait(long timeout, TimeUnit unit)
    void
    Initiate the client shutdown sequence.
    Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).
    shutdownAndForget(long timeout, TimeUnit unit)
    Initiate the client shutdown sequence.
     
    io.smallrye.mutiny.Uni<Boolean>
    updateSSLOptions(io.vertx.core.net.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.
    io.smallrye.mutiny.Uni<Boolean>
    updateSSLOptions(io.vertx.core.net.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.
    updateSSLOptionsAndAwait(io.vertx.core.net.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.
    updateSSLOptionsAndAwait(io.vertx.core.net.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.
    updateSSLOptionsAndForget(io.vertx.core.net.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.
    updateSSLOptionsAndForget(io.vertx.core.net.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(io.vertx.core.net.NetClient delegate)
      Create a new instance of NetClient delegating to the given (non-null) instance of NetClient.
    • NetClient

      public NetClient(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.core.net.NetClient getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface Measured
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<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.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      port - the port
      host - the host
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.connect(int, String)
    • connectAndAwait

      public NetSocket connectAndAwait(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.

      Unlike the bare Vert.x variant, this method returns a NetSocket. This method awaits indefinitely 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:
      port - the port
      host - the host
      Returns:
      The operation result
      See Also:
      • NetClient.connect(int, String)
    • connectAndForget

      public NetClient connectAndForget(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.

      Unlike the bare Vert.x variant, this method ignores the NetSocket result or any failure.

      Parameters:
      port - the port
      host - the host
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.connect(int, String)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<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.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      port - the port
      host - the host
      serverName - the SNI server name
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.connect(int, String, String)
    • connectAndAwait

      public NetSocket connectAndAwait(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.

      Unlike the bare Vert.x variant, this method returns a NetSocket. This method awaits indefinitely 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:
      port - the port
      host - the host
      serverName - the SNI server name
      Returns:
      The operation result
      See Also:
      • NetClient.connect(int, String, String)
    • connectAndForget

      public NetClient connectAndForget(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.

      Unlike the bare Vert.x variant, this method ignores the NetSocket result or any failure.

      Parameters:
      port - the port
      host - the host
      serverName - the SNI server name
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.connect(int, String, String)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(io.vertx.core.net.SocketAddress remoteAddress)
      Open a connection to a server at the specific remoteAddress.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      remoteAddress - the remote address
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.connect(SocketAddress)
    • connectAndAwait

      public NetSocket connectAndAwait(io.vertx.core.net.SocketAddress remoteAddress)
      Open a connection to a server at the specific remoteAddress.

      Unlike the bare Vert.x variant, this method returns a NetSocket. This method awaits indefinitely 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:
      remoteAddress - the remote address
      Returns:
      The operation result
      See Also:
      • NetClient.connect(SocketAddress)
    • connectAndForget

      public NetClient connectAndForget(io.vertx.core.net.SocketAddress remoteAddress)
      Open a connection to a server at the specific remoteAddress.

      Unlike the bare Vert.x variant, this method ignores the NetSocket result or any failure.

      Parameters:
      remoteAddress - the remote address
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.connect(SocketAddress)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(io.vertx.core.net.SocketAddress remoteAddress, String serverName)
      Open a connection to a server at the specific remoteAddress.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      remoteAddress - the remote address
      serverName - the SNI server name
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.connect(SocketAddress, String)
    • connectAndAwait

      public NetSocket connectAndAwait(io.vertx.core.net.SocketAddress remoteAddress, String serverName)
      Open a connection to a server at the specific remoteAddress.

      Unlike the bare Vert.x variant, this method returns a NetSocket. This method awaits indefinitely 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:
      remoteAddress - the remote address
      serverName - the SNI server name
      Returns:
      The operation result
      See Also:
      • NetClient.connect(SocketAddress, String)
    • connectAndForget

      public NetClient connectAndForget(io.vertx.core.net.SocketAddress remoteAddress, String serverName)
      Open a connection to a server at the specific remoteAddress.

      Unlike the bare Vert.x variant, this method ignores the NetSocket result or any failure.

      Parameters:
      remoteAddress - the remote address
      serverName - the SNI server name
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.connect(SocketAddress, String)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(io.vertx.core.net.ConnectOptions connectOptions)
      Open a connection to a server at the specific connectOptions.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      connectOptions - the options describing how to connect to the remote server
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.connect(ConnectOptions)
    • connectAndAwait

      public NetSocket connectAndAwait(io.vertx.core.net.ConnectOptions connectOptions)
      Open a connection to a server at the specific connectOptions.

      Unlike the bare Vert.x variant, this method returns a NetSocket. This method awaits indefinitely 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:
      connectOptions - the options describing how to connect to the remote server
      Returns:
      The operation result
      See Also:
      • NetClient.connect(ConnectOptions)
    • connectAndForget

      public NetClient connectAndForget(io.vertx.core.net.ConnectOptions connectOptions)
      Open a connection to a server at the specific connectOptions.

      Unlike the bare Vert.x variant, this method ignores the NetSocket result or any failure.

      Parameters:
      connectOptions - the options describing how to connect to the remote server
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.connect(ConnectOptions)
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Close immediately (shutdown(0, TimeUnit.SECONDS).

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.close()
    • closeAndAwait

      public void closeAndAwait()
      Close immediately (shutdown(0, TimeUnit.SECONDS).

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • NetClient.close()
    • closeAndForget

      public NetClient closeAndForget()
      Close immediately (shutdown(0, TimeUnit.SECONDS).

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.close()
    • shutdown

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> shutdown()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.shutdown()
    • shutdownAndAwait

      public void shutdownAndAwait()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • NetClient.shutdown()
    • shutdownAndForget

      public NetClient shutdownAndForget()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.shutdown()
    • shutdown

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> shutdown(long timeout, TimeUnit unit)
      Calls shutdown(Duration).

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.shutdown(long, TimeUnit)
    • shutdownAndAwait

      public void shutdownAndAwait(long timeout, TimeUnit unit)
      Calls shutdown(Duration).

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • NetClient.shutdown(long, TimeUnit)
    • shutdownAndForget

      public NetClient shutdownAndForget(long timeout, TimeUnit unit)
      Calls shutdown(Duration).

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.shutdown(long, TimeUnit)
    • shutdown

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> shutdown(Duration timeout)
      Initiate the client shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through NetSocket.shutdownHandler(Handler). When all connections are closed the client is closed. When the timeout expires, all unclosed connections are immediately closed.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      timeout - the amount of time after which all resources are forcibly closed
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.shutdown(Duration)
    • shutdownAndAwait

      public void shutdownAndAwait(Duration timeout)
      Initiate the client shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through NetSocket.shutdownHandler(Handler). When all connections are closed the client is closed. When the timeout expires, all unclosed connections are immediately closed.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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 - the amount of time after which all resources are forcibly closed
      See Also:
      • NetClient.shutdown(Duration)
    • shutdownAndForget

      public NetClient shutdownAndForget(Duration timeout)
      Initiate the client shutdown sequence.

      Connections are taken out of service and notified the close sequence has started through NetSocket.shutdownHandler(Handler). When all connections are closed the client is closed. When the timeout expires, all unclosed connections are immediately closed.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      timeout - the amount of time after which all resources are forcibly closed
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.shutdown(Duration)
    • updateSSLOptions

      @CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.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 uni result indicates whether the update occurred.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      options - the new SSL options
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.updateSSLOptions(ClientSSLOptions)
    • updateSSLOptionsAndAwait

      public Boolean updateSSLOptionsAndAwait(io.vertx.core.net.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 underlying uni result indicates whether the update occurred.

      Unlike the bare Vert.x variant, this method returns a Boolean. This method awaits indefinitely 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:
      options - the new SSL options
      Returns:
      The operation result
      See Also:
      • NetClient.updateSSLOptions(ClientSSLOptions)
    • updateSSLOptionsAndForget

      public NetClient updateSSLOptionsAndForget(io.vertx.core.net.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 underlying uni result indicates whether the update occurred.

      Unlike the bare Vert.x variant, this method ignores the Boolean result or any failure.

      Parameters:
      options - the new SSL options
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.updateSSLOptions(ClientSSLOptions)
    • updateSSLOptions

      @CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.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 uni result indicates whether the update occurred.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      options - the new SSL options
      force - force the update when options are equals
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • NetClient.updateSSLOptions(ClientSSLOptions, boolean)
    • updateSSLOptionsAndAwait

      public Boolean updateSSLOptionsAndAwait(io.vertx.core.net.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 underlying uni result indicates whether the update occurred.

      Unlike the bare Vert.x variant, this method returns a Boolean. This method awaits indefinitely 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:
      options - the new SSL options
      force - force the update when options are equals
      Returns:
      The operation result
      See Also:
      • NetClient.updateSSLOptions(ClientSSLOptions, boolean)
    • updateSSLOptionsAndForget

      public NetClient updateSSLOptionsAndForget(io.vertx.core.net.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 underlying uni result indicates whether the update occurred.

      Unlike the bare Vert.x variant, this method ignores the Boolean result or any failure.

      Parameters:
      options - the new SSL options
      force - force the update when options are equals
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • NetClient.updateSSLOptions(ClientSSLOptions, boolean)
    • 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
    • newInstance

      public static NetClient newInstance(io.vertx.core.net.NetClient delegate)
      Creates a new instance of the NetClient.
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object