Package org.apache.hc.core5.http.io
Class SocketConfig.Builder
- java.lang.Object
-
- org.apache.hc.core5.http.io.SocketConfig.Builder
-
- Enclosing class:
- SocketConfig
public static class SocketConfig.Builder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private intbacklogSizeprivate intrcvBufSizeprivate intsndBufSizeprivate java.net.SocketAddresssocksProxyAddressprivate booleansoKeepAliveprivate TimeValuesoLingerprivate booleansoReuseAddressprivate TimeoutsoTimeoutprivate inttcpKeepCountprivate inttcpKeepIdleprivate inttcpKeepIntervalprivate booleantcpNoDelay
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketConfigbuild()SocketConfig.BuildersetBacklogSize(int backlogSize)Determines the maximum queue length for incoming connection indications (a request to connect) also known as server socket backlog.SocketConfig.BuildersetRcvBufSize(int rcvBufSize)Determines the default value of theSocketOptions.SO_RCVBUFparameter for newly created sockets.SocketConfig.BuildersetSndBufSize(int sndBufSize)Determines the default value of theSocketOptions.SO_SNDBUFparameter for newly created sockets.SocketConfig.BuildersetSocksProxyAddress(java.net.SocketAddress socksProxyAddress)The address of the SOCKS proxy to use.SocketConfig.BuildersetSoKeepAlive(boolean soKeepAlive)Determines the default value of theSocketOptions.SO_KEEPALIVEparameter for newly created sockets.SocketConfig.BuildersetSoLinger(int soLinger, java.util.concurrent.TimeUnit timeUnit)SocketConfig.BuildersetSoLinger(TimeValue soLinger)Determines the default value of theSocketOptions.SO_LINGERparameter for newly created sockets.SocketConfig.BuildersetSoReuseAddress(boolean soReuseAddress)Determines the default value of theSocketOptions.SO_REUSEADDRparameter for newly created sockets.SocketConfig.BuildersetSoTimeout(int soTimeout, java.util.concurrent.TimeUnit timeUnit)SocketConfig.BuildersetSoTimeout(Timeout soTimeout)Determines the default socket timeout value for blocking I/O operations.SocketConfig.BuildersetTcpKeepCount(int tcpKeepCount)Determines the maximum number of keepalive probes TCP should send before dropping the connection.SocketConfig.BuildersetTcpKeepIdle(int tcpKeepIdle)Determines the time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes.SocketConfig.BuildersetTcpKeepInterval(int tcpKeepInterval)Determines the time (in seconds) between individual keepalive probes.SocketConfig.BuildersetTcpNoDelay(boolean tcpNoDelay)Determines the default value of theSocketOptions.TCP_NODELAYparameter for newly created sockets.
-
-
-
Field Detail
-
soTimeout
private Timeout soTimeout
-
soReuseAddress
private boolean soReuseAddress
-
soLinger
private TimeValue soLinger
-
soKeepAlive
private boolean soKeepAlive
-
tcpNoDelay
private boolean tcpNoDelay
-
sndBufSize
private int sndBufSize
-
rcvBufSize
private int rcvBufSize
-
backlogSize
private int backlogSize
-
tcpKeepIdle
private int tcpKeepIdle
-
tcpKeepInterval
private int tcpKeepInterval
-
tcpKeepCount
private int tcpKeepCount
-
socksProxyAddress
private java.net.SocketAddress socksProxyAddress
-
-
Method Detail
-
setSoTimeout
public SocketConfig.Builder setSoTimeout(int soTimeout, java.util.concurrent.TimeUnit timeUnit)
- Returns:
- this instance.
- See Also:
setSoTimeout(Timeout)
-
setSoTimeout
public SocketConfig.Builder setSoTimeout(Timeout soTimeout)
Determines the default socket timeout value for blocking I/O operations.Default: 3 minutes
- Returns:
- this instance.
- See Also:
SocketOptions.SO_TIMEOUT
-
setSoReuseAddress
public SocketConfig.Builder setSoReuseAddress(boolean soReuseAddress)
Determines the default value of theSocketOptions.SO_REUSEADDRparameter for newly created sockets.Default:
false- Returns:
- this instance.
- See Also:
SocketOptions.SO_REUSEADDR
-
setSoLinger
public SocketConfig.Builder setSoLinger(int soLinger, java.util.concurrent.TimeUnit timeUnit)
- Returns:
- this instance.
- See Also:
setSoLinger(TimeValue)
-
setSoLinger
public SocketConfig.Builder setSoLinger(TimeValue soLinger)
Determines the default value of theSocketOptions.SO_LINGERparameter for newly created sockets.Default:
-1- Returns:
- this instance.
- See Also:
SocketOptions.SO_LINGER
-
setSoKeepAlive
public SocketConfig.Builder setSoKeepAlive(boolean soKeepAlive)
Determines the default value of theSocketOptions.SO_KEEPALIVEparameter for newly created sockets.Default:
true- Returns:
- this instance.
- See Also:
SocketOptions.SO_KEEPALIVE
-
setTcpNoDelay
public SocketConfig.Builder setTcpNoDelay(boolean tcpNoDelay)
Determines the default value of theSocketOptions.TCP_NODELAYparameter for newly created sockets.Default:
false- Returns:
- this instance.
- See Also:
SocketOptions.TCP_NODELAY
-
setSndBufSize
public SocketConfig.Builder setSndBufSize(int sndBufSize)
Determines the default value of theSocketOptions.SO_SNDBUFparameter for newly created sockets.Default:
0(system default)- Returns:
- this instance.
- Since:
- 4.4
- See Also:
SocketOptions.SO_SNDBUF
-
setRcvBufSize
public SocketConfig.Builder setRcvBufSize(int rcvBufSize)
Determines the default value of theSocketOptions.SO_RCVBUFparameter for newly created sockets.Default:
0(system default)- Returns:
- this instance.
- Since:
- 4.4
- See Also:
SocketOptions.SO_RCVBUF
-
setBacklogSize
public SocketConfig.Builder setBacklogSize(int backlogSize)
Determines the maximum queue length for incoming connection indications (a request to connect) also known as server socket backlog.Default:
0(system default)- Returns:
- this instance.
- Since:
- 4.4
-
setTcpKeepIdle
public SocketConfig.Builder setTcpKeepIdle(int tcpKeepIdle)
Determines the time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes.Default:
5- Returns:
- this instance.
- Since:
- 5.3
-
setTcpKeepInterval
public SocketConfig.Builder setTcpKeepInterval(int tcpKeepInterval)
Determines the time (in seconds) between individual keepalive probes.Default:
5- Returns:
- this instance.
- Since:
- 5.3
-
setTcpKeepCount
public SocketConfig.Builder setTcpKeepCount(int tcpKeepCount)
Determines the maximum number of keepalive probes TCP should send before dropping the connection.Default:
3- Returns:
- this instance.
- Since:
- 5.3
-
setSocksProxyAddress
public SocketConfig.Builder setSocksProxyAddress(java.net.SocketAddress socksProxyAddress)
The address of the SOCKS proxy to use.- Returns:
- this instance.
-
build
public SocketConfig build()
-
-