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 booleanDEFAULT_SSLSSL enable by default = false
-
Constructor Summary
Constructors Constructor Description ConnectOptions()The default constructorConnectOptions(ConnectOptions other)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetHost()Get the host name to be used by the client connection.IntegergetPort()Get the port to be used by the client connection.ProxyOptionsgetProxyOptions()Get proxy options for connectionsSocketAddressgetRemoteAddress()Get the remote address to connect to, if none is providedhost/portwille be used.StringgetSniServerName()ClientSSLOptionsgetSslOptions()intgetTimeout()booleanisSsl()ConnectOptionssetHost(String host)Set the host name to be used by the client connection.ConnectOptionssetPort(Integer port)Set the port to be used by the client connection.ConnectOptionssetProxyOptions(ProxyOptions proxyOptions)Set proxy options for connections via CONNECT proxy (e.g.ConnectOptionssetRemoteAddress(SocketAddress remoteAddress)Set the remote address to be used by the client connection.ConnectOptionssetSniServerName(String sniServerName)Set the SNI server name to use.ConnectOptionssetSsl(boolean ssl)Set whether SSL/TLS is enabled.ConnectOptionssetSslOptions(ClientSSLOptions sslOptions)Set the SSL options to use.ConnectOptionssetTimeout(int timeout)Override the client connect timeout in millis whentimeout >= 0or use the client defined connect timeoutClientOptionsBase.getConnectTimeout()whentimeout == -1.
-
-
-
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 providedhost/portwille 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 thehostproperty by the Vert.x resolver and theportwill 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
NetClientOptionsproxy 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-trueif 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
NetClientOptionsSSL 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
-1when using the client defined connect timeoutClientOptionsBase.getConnectTimeout()
-
setTimeout
public ConnectOptions setTimeout(int timeout)
Override the client connect timeout in millis whentimeout >= 0or use the client defined connect timeoutClientOptionsBase.getConnectTimeout()whentimeout == -1.- Parameters:
timeout- connect timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
-