Class ConnectOptions

java.lang.Object
io.vertx.core.net.ConnectOptions

public class ConnectOptions extends Object
Options for configuring how to connect to a TCP server.
Author:
Julien Viet
  • Field Details

    • DEFAULT_SSL

      public static final boolean DEFAULT_SSL
      SSL enable by default = false
      See Also:
  • Constructor Details

    • ConnectOptions

      public ConnectOptions()
      The default constructor
    • ConnectOptions

      public ConnectOptions(ConnectOptions other)
      Copy constructor
      Parameters:
      other - the options to copy
  • Method Details

    • getHost

      public String getHost()
      Get the host name to be used by the client connection.
      Returns:
      the host name
    • setHost

      public ConnectOptions setHost(String host)
      Set the host name to be used by the client connection.
      Returns:
      a reference to this, so the API can be used fluently
    • getPort

      public Integer getPort()
      Get the port to be used by the client connection.
      Returns:
      the port
    • setPort

      public ConnectOptions setPort(Integer port)
      Set the port to be used by the client connection.
      Returns:
      a reference to this, so the API can be used fluently
    • getRemoteAddress

      public SocketAddress getRemoteAddress()
      Get the remote address to connect to, if none is provided host/port wille be used.
      Returns:
      the remote address
    • setRemoteAddress

      public ConnectOptions setRemoteAddress(SocketAddress remoteAddress)
      Set the remote address to be used by the client connection.

      When the server address is null, the address will be resolved after the host property by the Vert.x resolver and the port will be used.

      Use this when you want to connect to a specific server address without name resolution or use a domain socket.

      Returns:
      a reference to this, so the API can be used fluently
    • getSniServerName

      public String getSniServerName()
      Returns:
      the SNI (server name indication) server name
    • setSniServerName

      public ConnectOptions setSniServerName(String sniServerName)
      Set the SNI server name to use.
      Parameters:
      sniServerName - the server name
      Returns:
      a reference to this, so the API can be used fluently
    • getProxyOptions

      public ProxyOptions getProxyOptions()
      Get proxy options for connections
      Returns:
      proxy options
    • setProxyOptions

      public ConnectOptions setProxyOptions(ProxyOptions proxyOptions)
      Set proxy options for connections via CONNECT proxy (e.g. Squid) or a SOCKS proxy.

      When none is provided, the NetClientOptions proxy options will be used instead.

      Parameters:
      proxyOptions - proxy options object
      Returns:
      a reference to this, so the API can be used fluently
    • isSsl

      public boolean isSsl()
      Returns:
      is SSL/TLS enabled?
    • setSsl

      public ConnectOptions setSsl(boolean ssl)
      Set whether SSL/TLS is enabled.
      Parameters:
      ssl - true if enabled
      Returns:
      a reference to this, so the API can be used fluently
    • getSslOptions

      public ClientSSLOptions getSslOptions()
      Returns:
      the SSL options
    • setSslOptions

      public ConnectOptions setSslOptions(ClientSSLOptions sslOptions)
      Set the SSL options to use.

      When none is provided, the NetClientOptions SSL options will be used instead.

      Parameters:
      sslOptions - the SSL options to use
      Returns:
      a reference to this, so the API can be used fluently
    • getTimeout

      public int getTimeout()
      Returns:
      the value of connect timeout in millis or -1 when using the client defined connect timeout ClientOptionsBase.getConnectTimeout()
    • setTimeout

      public ConnectOptions setTimeout(int timeout)
      Override the client connect timeout in millis when timeout >= 0 or use the client defined connect timeout ClientOptionsBase.getConnectTimeout() when timeout == -1.
      Parameters:
      timeout - connect timeout, in ms
      Returns:
      a reference to this, so the API can be used fluently