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 RX-ified interface using Vert.x codegen.

    • Constructor Detail

      • NetClient

        public NetClient​(NetClient delegate)
      • NetClient

        public NetClient​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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 NetClient connect​(int port,
                                 String host,
                                 Handler<AsyncResult<NetSocket>> connectHandler)
        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

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

        public NetClient 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

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

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

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

        public NetClient connect​(int port,
                                 String host,
                                 String serverName,
                                 Handler<AsyncResult<NetSocket>> connectHandler)
        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

        Parameters:
        port - the port
        host - the host
        serverName - the SNI server name
        connectHandler -
        Returns:
        a reference to this, so the API can be used fluently
      • connect

        public NetClient 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

        Parameters:
        port - the port
        host - the host
        serverName - the SNI server name
        Returns:
        a reference to this, so the API can be used fluently
      • rxConnect

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

        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 NetClient connect​(SocketAddress remoteAddress,
                                 Handler<AsyncResult<NetSocket>> connectHandler)
        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

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

        public NetClient 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

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

        public rx.Single<NetSocket> rxConnect​(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

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

        public NetClient connect​(SocketAddress remoteAddress,
                                 String serverName,
                                 Handler<AsyncResult<NetSocket>> connectHandler)
        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

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

        public NetClient 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

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

        public rx.Single<NetSocket> rxConnect​(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

        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​(Handler<AsyncResult<Void>> handler)
        Close the client.

        Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not complete until some time after the method has returned.

        Parameters:
        handler -
      • close

        public void close()
        Close the client.

        Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not complete until some time after the method has returned.

      • rxClose

        public rx.Single<Void> rxClose()
        Close the client.

        Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not complete until some time after the method has returned.

        Returns: