Class NetClient

  • All Implemented Interfaces:
    Measured

    public class NetClient
    extends Object
    implements 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 Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • NetClient

        public NetClient​(io.vertx.core.net.NetClient delegate)
    • Method Detail

      • getDelegate

        public io.vertx.core.net.NetClient getDelegate()
        Specified by:
        getDelegate in interface Measured
      • hashCode

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

        public boolean isMetricsEnabled()
        Specified by:
        isMetricsEnabled in interface Measured
        Returns:
        true if metrics are enabled
      • connect

        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. The connect is done asynchronously and on success, a NetSocket instance is supplied via the connectHandler instance

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

        Parameters:
        port - the port
        host - the host
        Returns:
        a reference to this, so the API can be used fluently
      • connectAndAwait

        public NetSocket connectAndAwait​(int port,
                                         String host)
        Blocking variant of connect(int,String).

        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:
        port - the port
        host - the host
        Returns:
        a reference to this, so the API can be used fluently
      • connect

        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. The connect is done asynchronously and on success, a NetSocket instance is supplied via the connectHandler instance

        Unlike the bare Vert.x variant, this method returns a Uni. 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 reference to this, so the API can be used fluently
      • connectAndAwait

        public NetSocket connectAndAwait​(int port,
                                         String host,
                                         String serverName)
        Blocking variant of connect(int,String,String).

        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:
        port - the port
        host - the host
        serverName - the SNI server name
        Returns:
        a reference to this, so the API can be used fluently
      • connect

        public io.smallrye.mutiny.Uni<NetSocket> connect​(SocketAddress remoteAddress)
        Open a connection to a server at the specific remoteAddress.

        The connect is done asynchronously and on success, a NetSocket instance is supplied via the connectHandler instance

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

        Parameters:
        remoteAddress - the remote address
        Returns:
        a reference to this, so the API can be used fluently
      • connectAndAwait

        public NetSocket connectAndAwait​(SocketAddress remoteAddress)
        Blocking variant of connect(io.vertx.mutiny.core.net.SocketAddress).

        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:
        remoteAddress - the remote address
        Returns:
        a reference to this, so the API can be used fluently
      • connect

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

        The connect is done asynchronously and on success, a NetSocket instance is supplied via the connectHandler instance

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

        Parameters:
        remoteAddress - the remote address
        serverName - the SNI server name
        Returns:
        a reference to this, so the API can be used fluently
      • connectAndAwait

        public NetSocket connectAndAwait​(SocketAddress remoteAddress,
                                         String serverName)
        Blocking variant of connect(io.vertx.mutiny.core.net.SocketAddress,String).

        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:
        remoteAddress - the remote address
        serverName - the SNI server name
        Returns:
        a reference to this, so the API can be used fluently
      • close

        public void close()
      • newInstance

        public static NetClient newInstance​(io.vertx.core.net.NetClient arg)