Package io.vertx.core.net

## 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 Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static boolean` | `DEFAULT_SSL` | SSL enable by default = false

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConnectOptions()` | The default constructor
    `ConnectOptions​(ConnectOptions other)` | Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `getHost()` | Get the host name to be used by the client connection.
    `Integer` | `getPort()` | Get the port to be used by the client connection.
    `ProxyOptions` | `getProxyOptions()` | Get proxy options for connections
    `SocketAddress` | `getRemoteAddress()` | Get the remote address to connect to, if none is provided `host`/`port` wille be used.
    `String` | `getSniServerName()` |
    `ClientSSLOptions` | `getSslOptions()` |
    `int` | `getTimeout()` |
    `boolean` | `isSsl()` |
    `ConnectOptions` | `setHost​(String host)` | Set the host name to be used by the client connection.
    `ConnectOptions` | `setPort​(Integer port)` | Set the port to be used by the client connection.
    `ConnectOptions` | `setProxyOptions​(ProxyOptions proxyOptions)` | Set proxy options for connections via CONNECT proxy (e.g.
    `ConnectOptions` | `setRemoteAddress​(SocketAddress remoteAddress)` | Set the remote address to be used by the client connection.
    `ConnectOptions` | `setSniServerName​(String sniServerName)` | Set the SNI server name to use.
    `ConnectOptions` | `setSsl​(boolean ssl)` | Set whether SSL/TLS is enabled.
    `ConnectOptions` | `setSslOptions​(ClientSSLOptions sslOptions)` | Set the SSL options to use.
    `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`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_SSL

          public static final boolean DEFAULT_SSL

      SSL enable by default = false
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ConnectOptions

          public ConnectOptions()

      The default constructor

    - #### ConnectOptions

          public ConnectOptions​(ConnectOptions other)

      Copy constructor
      Parameters:
        `other` - the options to copy

  - ### Method Detail

    - #### 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