Package io.vertx.core.net
Class ClientOptionsBase
- java.lang.Object
-
- io.vertx.core.net.NetworkOptions
-
- io.vertx.core.net.TCPSSLOptions
-
- io.vertx.core.net.ClientOptionsBase
-
- Direct Known Subclasses:
HttpClientOptions
,NetClientOptions
,WebSocketClientOptions
public abstract class ClientOptionsBase extends TCPSSLOptions
Base class for Client options- Author:
- Tim Fox
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CONNECT_TIMEOUT
The default value of connect timeout = 60000 (ms)static String
DEFAULT_METRICS_NAME
The default value of the client metrics = "":-
Fields inherited from class io.vertx.core.net.TCPSSLOptions
DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUT
-
Fields inherited from class io.vertx.core.net.NetworkOptions
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
-
-
Constructor Summary
Constructors Constructor Description ClientOptionsBase()
Default constructorClientOptionsBase(JsonObject json)
Create options from some JSONClientOptionsBase(ClientOptionsBase other)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientOptionsBase
addCrlPath(String crlPath)
Add a CRL pathClientOptionsBase
addCrlValue(Buffer crlValue)
Add a CRL valueClientOptionsBase
addEnabledCipherSuite(String suite)
Add an enabled cipher suite, appended to the ordered suites.ClientOptionsBase
addEnabledSecureTransportProtocol(String protocol)
Add an enabled SSL/TLS protocols, appended to the ordered protocols.ClientOptionsBase
addNonProxyHost(String host)
Add ahost
to thegetNonProxyHosts()
list.int
getConnectTimeout()
String
getLocalAddress()
String
getMetricsName()
List<String>
getNonProxyHosts()
protected ClientSSLOptions
getOrCreateSSLOptions()
ProxyOptions
getProxyOptions()
Get proxy options for connectionsClientSSLOptions
getSslOptions()
boolean
isTrustAll()
ClientOptionsBase
removeEnabledCipherSuite(String suite)
Removes an enabled cipher suite from the ordered suites.ClientOptionsBase
removeEnabledSecureTransportProtocol(String protocol)
Removes an enabled SSL/TLS protocol from the ordered protocols.ClientOptionsBase
setActivityLogDataFormat(ByteBufFormat activityLogDataFormat)
Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.ClientOptionsBase
setConnectTimeout(int connectTimeout)
Set the connect timeoutClientOptionsBase
setIdleTimeout(int idleTimeout)
Set the idle timeout, default time unit is seconds.ClientOptionsBase
setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Set the idle timeout unit.ClientOptionsBase
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.ClientOptionsBase
setLocalAddress(String localAddress)
Set the local interface to bind for network connections.ClientOptionsBase
setLogActivity(boolean logEnabled)
Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.ClientOptionsBase
setMetricsName(String metricsName)
Set the metrics name identifying the reported metrics, useful for grouping metrics with the same name.ClientOptionsBase
setNonProxyHosts(List<String> nonProxyHosts)
Set a list of remote hosts that are not proxied when the client is configured to use a proxy.ClientOptionsBase
setProxyOptions(ProxyOptions proxyOptions)
Set proxy options for connections via CONNECT proxy (e.g.ClientOptionsBase
setReadIdleTimeout(int idleTimeout)
Set the read idle timeout, default time unit is seconds.ClientOptionsBase
setReceiveBufferSize(int receiveBufferSize)
Set the TCP receive buffer sizeClientOptionsBase
setReuseAddress(boolean reuseAddress)
Set the value of reuse addressClientOptionsBase
setReusePort(boolean reusePort)
Set the value of reuse port.ClientOptionsBase
setSendBufferSize(int sendBufferSize)
Set the TCP send buffer sizeClientOptionsBase
setSoLinger(int soLinger)
Set whether SO_linger keep alive is enabledClientOptionsBase
setSsl(boolean ssl)
Set whether SSL/TLS is enabledClientOptionsBase
setSslEngineOptions(SSLEngineOptions sslEngineOptions)
Set to use SSL engine implementation to use.ClientOptionsBase
setTcpCork(boolean tcpCork)
Enable theTCP_CORK
option - only with linux native transport.ClientOptionsBase
setTcpFastOpen(boolean tcpFastOpen)
Enable theTCP_FASTOPEN
option - only with linux native transport.ClientOptionsBase
setTcpKeepAlive(boolean tcpKeepAlive)
Set whether TCP keep alive is enabledClientOptionsBase
setTcpNoDelay(boolean tcpNoDelay)
Set whether TCP no delay is enabledClientOptionsBase
setTcpQuickAck(boolean tcpQuickAck)
Enable theTCP_QUICKACK
option - only with linux native transport.ClientOptionsBase
setTcpUserTimeout(int tcpUserTimeout)
Sets theTCP_USER_TIMEOUT
option - only with linux native transport.ClientOptionsBase
setTrafficClass(int trafficClass)
Set the value of traffic classClientOptionsBase
setTrustAll(boolean trustAll)
Set whether all server certificates should be trustedClientOptionsBase
setTrustOptions(TrustOptions options)
Set the trust options.ClientOptionsBase
setUseAlpn(boolean useAlpn)
Set the ALPN usage.ClientOptionsBase
setWriteIdleTimeout(int idleTimeout)
Set the write idle timeout, default time unit is seconds.JsonObject
toJson()
Convert to JSON-
Methods inherited from class io.vertx.core.net.TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpUserTimeout, getTrustOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setEnabledSecureTransportProtocols, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit
-
Methods inherited from class io.vertx.core.net.NetworkOptions
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
-
-
-
-
Field Detail
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUT
The default value of connect timeout = 60000 (ms)- See Also:
- Constant Field Values
-
DEFAULT_METRICS_NAME
public static final String DEFAULT_METRICS_NAME
The default value of the client metrics = "":- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClientOptionsBase
public ClientOptionsBase()
Default constructor
-
ClientOptionsBase
public ClientOptionsBase(ClientOptionsBase other)
Copy constructor- Parameters:
other
- the options to copy
-
ClientOptionsBase
public ClientOptionsBase(JsonObject json)
Create options from some JSON- Parameters:
json
- the JSON
-
-
Method Detail
-
toJson
public JsonObject toJson()
Convert to JSON- Overrides:
toJson
in classTCPSSLOptions
- Returns:
- the JSON
-
getSslOptions
public ClientSSLOptions getSslOptions()
- Overrides:
getSslOptions
in classTCPSSLOptions
-
getOrCreateSSLOptions
protected ClientSSLOptions getOrCreateSSLOptions()
- Overrides:
getOrCreateSSLOptions
in classTCPSSLOptions
-
isTrustAll
public boolean isTrustAll()
- Returns:
- true if all server certificates should be trusted
-
setTrustAll
public ClientOptionsBase setTrustAll(boolean trustAll)
Set whether all server certificates should be trusted- Parameters:
trustAll
- true if all should be trusted- Returns:
- a reference to this, so the API can be used fluently
-
getConnectTimeout
public int getConnectTimeout()
- Returns:
- the value of connect timeout
-
setConnectTimeout
public ClientOptionsBase setConnectTimeout(int connectTimeout)
Set the connect timeout- Parameters:
connectTimeout
- connect timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
getMetricsName
public String getMetricsName()
- Returns:
- the metrics name identifying the reported metrics.
-
setMetricsName
public ClientOptionsBase setMetricsName(String metricsName)
Set the metrics name identifying the reported metrics, useful for grouping metrics with the same name.- Parameters:
metricsName
- the metrics name- Returns:
- a reference to this, so the API can be used fluently
-
setProxyOptions
public ClientOptionsBase setProxyOptions(ProxyOptions proxyOptions)
Set proxy options for connections via CONNECT proxy (e.g. Squid) or a SOCKS proxy.- Parameters:
proxyOptions
- proxy options object- Returns:
- a reference to this, so the API can be used fluently
-
getProxyOptions
public ProxyOptions getProxyOptions()
Get proxy options for connections- Returns:
- proxy options
-
setNonProxyHosts
public ClientOptionsBase setNonProxyHosts(List<String> nonProxyHosts)
Set a list of remote hosts that are not proxied when the client is configured to use a proxy. This list serves the same purpose than the JVMnonProxyHosts
configuration.Entries can use the * wildcard character for pattern matching, e.g *.example.com matches www.example.com.
- Parameters:
nonProxyHosts
- the list of non proxies hosts- Returns:
- a reference to this, so the API can be used fluently
-
addNonProxyHost
public ClientOptionsBase addNonProxyHost(String host)
Add ahost
to thegetNonProxyHosts()
list.- Parameters:
host
- the added host- Returns:
- a reference to this, so the API can be used fluently
-
getLocalAddress
public String getLocalAddress()
- Returns:
- the local interface to bind for network connections.
-
setLocalAddress
public ClientOptionsBase setLocalAddress(String localAddress)
Set the local interface to bind for network connections. When the local address is null, it will pick any local address, the default local address is null.- Parameters:
localAddress
- the local address- Returns:
- a reference to this, so the API can be used fluently
-
setLogActivity
public ClientOptionsBase setLogActivity(boolean logEnabled)
Description copied from class:NetworkOptions
Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setLogActivity
in classTCPSSLOptions
- Parameters:
logEnabled
- true for logging the network activity- Returns:
- a reference to this, so the API can be used fluently
-
setActivityLogDataFormat
public ClientOptionsBase setActivityLogDataFormat(ByteBufFormat activityLogDataFormat)
Description copied from class:NetworkOptions
Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setActivityLogDataFormat
in classTCPSSLOptions
- Parameters:
activityLogDataFormat
- the format to use- Returns:
- a reference to this, so the API can be used fluently
-
setTcpNoDelay
public ClientOptionsBase setTcpNoDelay(boolean tcpNoDelay)
Description copied from class:TCPSSLOptions
Set whether TCP no delay is enabled- Overrides:
setTcpNoDelay
in classTCPSSLOptions
- Parameters:
tcpNoDelay
- true if TCP no delay is enabled (Nagle disabled)- Returns:
- a reference to this, so the API can be used fluently
-
setTcpKeepAlive
public ClientOptionsBase setTcpKeepAlive(boolean tcpKeepAlive)
Description copied from class:TCPSSLOptions
Set whether TCP keep alive is enabled- Overrides:
setTcpKeepAlive
in classTCPSSLOptions
- Parameters:
tcpKeepAlive
- true if TCP keep alive is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setSoLinger
public ClientOptionsBase setSoLinger(int soLinger)
Description copied from class:TCPSSLOptions
Set whether SO_linger keep alive is enabled- Overrides:
setSoLinger
in classTCPSSLOptions
- Parameters:
soLinger
- true if SO_linger is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeout
public ClientOptionsBase setIdleTimeout(int idleTimeout)
Description copied from class:TCPSSLOptions
Set the idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
- Overrides:
setIdleTimeout
in classTCPSSLOptions
- Parameters:
idleTimeout
- the timeout- Returns:
- a reference to this, so the API can be used fluently
-
setReadIdleTimeout
public ClientOptionsBase setReadIdleTimeout(int idleTimeout)
Description copied from class:TCPSSLOptions
Set the read idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
- Overrides:
setReadIdleTimeout
in classTCPSSLOptions
- Parameters:
idleTimeout
- the read timeout- Returns:
- a reference to this, so the API can be used fluently
-
setWriteIdleTimeout
public ClientOptionsBase setWriteIdleTimeout(int idleTimeout)
Description copied from class:TCPSSLOptions
Set the write idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is sent within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
- Overrides:
setWriteIdleTimeout
in classTCPSSLOptions
- Parameters:
idleTimeout
- the write timeout- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeoutUnit
public ClientOptionsBase setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Description copied from class:TCPSSLOptions
Set the idle timeout unit. If not specified, default is seconds.- Overrides:
setIdleTimeoutUnit
in classTCPSSLOptions
- Parameters:
idleTimeoutUnit
- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
setSsl
public ClientOptionsBase setSsl(boolean ssl)
Description copied from class:TCPSSLOptions
Set whether SSL/TLS is enabled- Overrides:
setSsl
in classTCPSSLOptions
- Parameters:
ssl
- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setKeyCertOptions
public ClientOptionsBase setKeyCertOptions(KeyCertOptions options)
Description copied from class:TCPSSLOptions
Set the key/cert options.- Overrides:
setKeyCertOptions
in classTCPSSLOptions
- Parameters:
options
- the key store options- Returns:
- a reference to this, so the API can be used fluently
-
setTrustOptions
public ClientOptionsBase setTrustOptions(TrustOptions options)
Description copied from class:TCPSSLOptions
Set the trust options.- Overrides:
setTrustOptions
in classTCPSSLOptions
- Parameters:
options
- the trust options- Returns:
- a reference to this, so the API can be used fluently
-
setUseAlpn
public ClientOptionsBase setUseAlpn(boolean useAlpn)
Description copied from class:TCPSSLOptions
Set the ALPN usage.- Overrides:
setUseAlpn
in classTCPSSLOptions
- Parameters:
useAlpn
- true when Application-Layer Protocol Negotiation should be used
-
setSslEngineOptions
public ClientOptionsBase setSslEngineOptions(SSLEngineOptions sslEngineOptions)
Description copied from class:TCPSSLOptions
Set to use SSL engine implementation to use.- Overrides:
setSslEngineOptions
in classTCPSSLOptions
- Parameters:
sslEngineOptions
- the ssl engine to use- Returns:
- a reference to this, so the API can be used fluently
-
setSendBufferSize
public ClientOptionsBase setSendBufferSize(int sendBufferSize)
Description copied from class:NetworkOptions
Set the TCP send buffer size- Overrides:
setSendBufferSize
in classTCPSSLOptions
- Parameters:
sendBufferSize
- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReceiveBufferSize
public ClientOptionsBase setReceiveBufferSize(int receiveBufferSize)
Description copied from class:NetworkOptions
Set the TCP receive buffer size- Overrides:
setReceiveBufferSize
in classTCPSSLOptions
- Parameters:
receiveBufferSize
- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReuseAddress
public ClientOptionsBase setReuseAddress(boolean reuseAddress)
Description copied from class:NetworkOptions
Set the value of reuse address- Overrides:
setReuseAddress
in classTCPSSLOptions
- Parameters:
reuseAddress
- the value of reuse address- Returns:
- a reference to this, so the API can be used fluently
-
setReusePort
public ClientOptionsBase setReusePort(boolean reusePort)
Description copied from class:NetworkOptions
Set the value of reuse port. This is only supported by native transports.- Overrides:
setReusePort
in classTCPSSLOptions
- Parameters:
reusePort
- the value of reuse port- Returns:
- a reference to this, so the API can be used fluently
-
setTrafficClass
public ClientOptionsBase setTrafficClass(int trafficClass)
Description copied from class:NetworkOptions
Set the value of traffic class- Overrides:
setTrafficClass
in classTCPSSLOptions
- Parameters:
trafficClass
- the value of traffic class- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledCipherSuite
public ClientOptionsBase addEnabledCipherSuite(String suite)
Description copied from class:TCPSSLOptions
Add an enabled cipher suite, appended to the ordered suites.- Overrides:
addEnabledCipherSuite
in classTCPSSLOptions
- Parameters:
suite
- the suite- Returns:
- a reference to this, so the API can be used fluently
- See Also:
TCPSSLOptions.getEnabledCipherSuites()
-
removeEnabledCipherSuite
public ClientOptionsBase removeEnabledCipherSuite(String suite)
Description copied from class:TCPSSLOptions
Removes an enabled cipher suite from the ordered suites.- Overrides:
removeEnabledCipherSuite
in classTCPSSLOptions
- Parameters:
suite
- the suite- Returns:
- a reference to this, so the API can be used fluently
-
addCrlPath
public ClientOptionsBase addCrlPath(String crlPath) throws NullPointerException
Description copied from class:TCPSSLOptions
Add a CRL path- Overrides:
addCrlPath
in classTCPSSLOptions
- Parameters:
crlPath
- the path- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
addCrlValue
public ClientOptionsBase addCrlValue(Buffer crlValue) throws NullPointerException
Description copied from class:TCPSSLOptions
Add a CRL value- Overrides:
addCrlValue
in classTCPSSLOptions
- Parameters:
crlValue
- the value- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
addEnabledSecureTransportProtocol
public ClientOptionsBase addEnabledSecureTransportProtocol(String protocol)
Description copied from class:TCPSSLOptions
Add an enabled SSL/TLS protocols, appended to the ordered protocols.- Overrides:
addEnabledSecureTransportProtocol
in classTCPSSLOptions
- Parameters:
protocol
- the SSL/TLS protocol to enable- Returns:
- a reference to this, so the API can be used fluently
-
removeEnabledSecureTransportProtocol
public ClientOptionsBase removeEnabledSecureTransportProtocol(String protocol)
Description copied from class:TCPSSLOptions
Removes an enabled SSL/TLS protocol from the ordered protocols.- Overrides:
removeEnabledSecureTransportProtocol
in classTCPSSLOptions
- Parameters:
protocol
- the SSL/TLS protocol to disable- Returns:
- a reference to this, so the API can be used fluently
-
setTcpFastOpen
public ClientOptionsBase setTcpFastOpen(boolean tcpFastOpen)
Description copied from class:TCPSSLOptions
Enable theTCP_FASTOPEN
option - only with linux native transport.- Overrides:
setTcpFastOpen
in classTCPSSLOptions
- Parameters:
tcpFastOpen
- the fast open value
-
setTcpCork
public ClientOptionsBase setTcpCork(boolean tcpCork)
Description copied from class:TCPSSLOptions
Enable theTCP_CORK
option - only with linux native transport.- Overrides:
setTcpCork
in classTCPSSLOptions
- Parameters:
tcpCork
- the cork value
-
setTcpQuickAck
public ClientOptionsBase setTcpQuickAck(boolean tcpQuickAck)
Description copied from class:TCPSSLOptions
Enable theTCP_QUICKACK
option - only with linux native transport.- Overrides:
setTcpQuickAck
in classTCPSSLOptions
- Parameters:
tcpQuickAck
- the quick ack value
-
setTcpUserTimeout
public ClientOptionsBase setTcpUserTimeout(int tcpUserTimeout)
Description copied from class:TCPSSLOptions
Sets theTCP_USER_TIMEOUT
option - only with linux native transport.- Overrides:
setTcpUserTimeout
in classTCPSSLOptions
- Parameters:
tcpUserTimeout
- the tcp user timeout value
-
-