Top Description Inners Fields Constructors Methods
org.apache.hc.core5.http.io

public Class SocketConfig

extends Object
Class Inheritance
Annotations
@Contract
threading:IMMUTABLE
Imports
java.net.SocketAddress, java.util.concurrent.TimeUnit, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.util.Args, .TimeValue, .Timeout

Classic I/O network socket configuration.
Since
4.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final int
public static final SocketConfig
private static final Timeout
private final int
private final int
private final SocketAddress
private final boolean
private final TimeValue
private final boolean
private final Timeout
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
SocketConfig(final Timeout soTimeout, final boolean soReuseAddress, final TimeValue soLinger, final boolean soKeepAlive, final boolean tcpNoDelay, final int sndBufSize, final int rcvBufSize, final int backlogSize, final SocketAddress socksProxyAddress)

Method Summary

Modifier and TypeMethod and Description
public static SocketConfig.Builder
copy(final SocketConfig config)

public static SocketConfig.Builder
public int
public int
public int
public SocketAddress
public TimeValue
public Timeout
public boolean
public boolean
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

backlogSizeback to summary
private final int backlogSize
DEFAULTback to summary
public static final SocketConfig DEFAULT
DEFAULT_SOCKET_TIMEOUTback to summary
private static final Timeout DEFAULT_SOCKET_TIMEOUT
rcvBufSizeback to summary
private final int rcvBufSize
sndBufSizeback to summary
private final int sndBufSize
socksProxyAddressback to summary
private final SocketAddress socksProxyAddress
soKeepAliveback to summary
private final boolean soKeepAlive
soLingerback to summary
private final TimeValue soLinger
soReuseAddressback to summary
private final boolean soReuseAddress
soTimeoutback to summary
private final Timeout soTimeout
tcpNoDelayback to summary
private final boolean tcpNoDelay

Constructor Detail

SocketConfigback to summary
pack-priv SocketConfig(final Timeout soTimeout, final boolean soReuseAddress, final TimeValue soLinger, final boolean soKeepAlive, final boolean tcpNoDelay, final int sndBufSize, final int rcvBufSize, final int backlogSize, final SocketAddress socksProxyAddress)

Method Detail

copyback to summary
public static SocketConfig.Builder copy(final SocketConfig config)
customback to summary
public static SocketConfig.Builder custom()
getBacklogSizeback to summary
public int getBacklogSize()
Since
4.4
See Also
Builder#setBacklogSize(int)
getRcvBufSizeback to summary
public int getRcvBufSize()
Since
4.4
See Also
Builder#setRcvBufSize(int)
getSndBufSizeback to summary
public int getSndBufSize()
Since
4.4
See Also
Builder#setSndBufSize(int)
getSocksProxyAddressback to summary
public SocketAddress getSocksProxyAddress()
See Also
Builder#setSocksProxyAddress(SocketAddress)
getSoLingerback to summary
public TimeValue getSoLinger()
See Also
Builder#setSoLinger(TimeValue)
getSoTimeoutback to summary
public Timeout getSoTimeout()
See Also
Builder#setSoTimeout(Timeout)
isSoKeepAliveback to summary
public boolean isSoKeepAlive()
See Also
Builder#setSoKeepAlive(boolean)
isSoReuseAddressback to summary
public boolean isSoReuseAddress()
See Also
Builder#setSoReuseAddress(boolean)
isTcpNoDelayback to summary
public boolean isTcpNoDelay()
See Also
Builder#setTcpNoDelay(boolean)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.apache.hc.core5.http.io back to summary

public Class SocketConfig.Builder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
private int
private SocketAddress
private boolean
private TimeValue
private boolean
private Timeout
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public SocketConfig
public SocketConfig.Builder

Returns:

the maximum queue length for incoming connection indications
setBacklogSize
(final int backlogSize)

Determines the maximum queue length for incoming connection indications (a request to connect) also known as server socket backlog.

public SocketConfig.Builder

Returns:

the default value of the java.net.SocketOptions#SO_RCVBUF parameter.
setRcvBufSize
(final int rcvBufSize)

Determines the default value of the java.net.SocketOptions#SO_RCVBUF parameter for newly created sockets.

public SocketConfig.Builder

Returns:

the default value of the java.net.SocketOptions#SO_SNDBUF parameter.
setSndBufSize
(final int sndBufSize)

Determines the default value of the java.net.SocketOptions#SO_SNDBUF parameter for newly created sockets.

public SocketConfig.Builder
setSocksProxyAddress(final SocketAddress socksProxyAddress)

The address of the SOCKS proxy to use.

public SocketConfig.Builder

Returns:

the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter.
setSoKeepAlive
(final boolean soKeepAlive)

Determines the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter for newly created sockets.

public SocketConfig.Builder
setSoLinger(final int soLinger, final TimeUnit timeUnit)

public SocketConfig.Builder

Returns:

the default value of the java.net.SocketOptions#SO_LINGER parameter.
setSoLinger
(final TimeValue soLinger)

Determines the default value of the java.net.SocketOptions#SO_LINGER parameter for newly created sockets.

public SocketConfig.Builder

Returns:

the default value of the java.net.SocketOptions#SO_REUSEADDR parameter.
setSoReuseAddress
(final boolean soReuseAddress)

Determines the default value of the java.net.SocketOptions#SO_REUSEADDR parameter for newly created sockets.

public SocketConfig.Builder
setSoTimeout(final int soTimeout, final TimeUnit timeUnit)

public SocketConfig.Builder

Returns:

the default socket timeout value for blocking I/O operations.
setSoTimeout
(final Timeout soTimeout)

Determines the default socket timeout value for blocking I/O operations.

public SocketConfig.Builder

Returns:

the default value of the java.net.SocketOptions#TCP_NODELAY parameter.
setTcpNoDelay
(final boolean tcpNoDelay)

Determines the default value of the java.net.SocketOptions#TCP_NODELAY parameter for newly created sockets.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backlogSizeback to summary
private int backlogSize
rcvBufSizeback to summary
private int rcvBufSize
sndBufSizeback to summary
private int sndBufSize
socksProxyAddressback to summary
private SocketAddress socksProxyAddress
soKeepAliveback to summary
private boolean soKeepAlive
soLingerback to summary
private TimeValue soLinger
soReuseAddressback to summary
private boolean soReuseAddress
soTimeoutback to summary
private Timeout soTimeout
tcpNoDelayback to summary
private boolean tcpNoDelay

Constructor Detail

Builderback to summary
pack-priv Builder()

Method Detail

buildback to summary
public SocketConfig build()
setBacklogSizeback to summary
public SocketConfig.Builder setBacklogSize(final 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:SocketConfig.Builder

the maximum queue length for incoming connection indications

Since
4.4
setRcvBufSizeback to summary
public SocketConfig.Builder setRcvBufSize(final int rcvBufSize)

Determines the default value of the java.net.SocketOptions#SO_RCVBUF parameter for newly created sockets.

Default: 0 (system default)

Returns:SocketConfig.Builder

the default value of the java.net.SocketOptions#SO_RCVBUF parameter.

Since
4.4
See Also
java.net.SocketOptions#SO_RCVBUF
setSndBufSizeback to summary
public SocketConfig.Builder setSndBufSize(final int sndBufSize)

Determines the default value of the java.net.SocketOptions#SO_SNDBUF parameter for newly created sockets.

Default: 0 (system default)

Returns:SocketConfig.Builder

the default value of the java.net.SocketOptions#SO_SNDBUF parameter.

Since
4.4
See Also
java.net.SocketOptions#SO_SNDBUF
setSocksProxyAddressback to summary
public SocketConfig.Builder setSocksProxyAddress(final SocketAddress socksProxyAddress)

The address of the SOCKS proxy to use.

setSoKeepAliveback to summary
public SocketConfig.Builder setSoKeepAlive(final boolean soKeepAlive)

Determines the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter for newly created sockets.

Default: false

Returns:SocketConfig.Builder

the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter.

See Also
java.net.SocketOptions#SO_KEEPALIVE
setSoLingerback to summary
public SocketConfig.Builder setSoLinger(final int soLinger, final TimeUnit timeUnit)
See Also
setSoLinger(TimeValue)
setSoLingerback to summary
public SocketConfig.Builder setSoLinger(final TimeValue soLinger)

Determines the default value of the java.net.SocketOptions#SO_LINGER parameter for newly created sockets.

Default: -1

Returns:SocketConfig.Builder

the default value of the java.net.SocketOptions#SO_LINGER parameter.

See Also
java.net.SocketOptions#SO_LINGER
setSoReuseAddressback to summary
public SocketConfig.Builder setSoReuseAddress(final boolean soReuseAddress)

Determines the default value of the java.net.SocketOptions#SO_REUSEADDR parameter for newly created sockets.

Default: false

Returns:SocketConfig.Builder

the default value of the java.net.SocketOptions#SO_REUSEADDR parameter.

See Also
java.net.SocketOptions#SO_REUSEADDR
setSoTimeoutback to summary
public SocketConfig.Builder setSoTimeout(final int soTimeout, final TimeUnit timeUnit)
See Also
setSoTimeout(Timeout)
setSoTimeoutback to summary
public SocketConfig.Builder setSoTimeout(final Timeout soTimeout)

Determines the default socket timeout value for blocking I/O operations.

Default: 3 minutes

Returns:SocketConfig.Builder

the default socket timeout value for blocking I/O operations.

See Also
java.net.SocketOptions#SO_TIMEOUT
setTcpNoDelayback to summary
public SocketConfig.Builder setTcpNoDelay(final boolean tcpNoDelay)

Determines the default value of the java.net.SocketOptions#TCP_NODELAY parameter for newly created sockets.

Default: false

Returns:SocketConfig.Builder

the default value of the java.net.SocketOptions#TCP_NODELAY parameter.

See Also
java.net.SocketOptions#TCP_NODELAY