public final class SocketOptionUtils
extends java.lang.Object
SocketOption
s.Modifier and Type | Method and Description |
---|---|
static <T> void |
addOption(java.util.Map<io.netty.channel.ChannelOption,java.lang.Object> channelOpts,
java.net.SocketOption<T> option,
java.lang.Object value)
Convert and add the given
SocketOption and value to the ChannelOption s Map . |
static <T> T |
getOption(java.net.SocketOption<T> option,
io.netty.channel.ChannelConfig config,
java.lang.Long idleTimeoutMs)
Get a
SocketOption value from ChannelConfig . |
public static <T> void addOption(java.util.Map<io.netty.channel.ChannelOption,java.lang.Object> channelOpts, java.net.SocketOption<T> option, java.lang.Object value)
SocketOption
and value to the ChannelOption
s Map
.T
- the type of the SocketOption
valuechannelOpts
- the Map
into which add the converted SocketOption
option
- the SocketOption
to convert and addvalue
- the value to addjava.lang.IllegalArgumentException
- if the specified SocketOption
is not supported@Nullable public static <T> T getOption(java.net.SocketOption<T> option, io.netty.channel.ChannelConfig config, @Nullable java.lang.Long idleTimeoutMs)
SocketOption
value from ChannelConfig
.T
- the type of the SocketOption
valueoption
- the SocketOption
to getconfig
- the ChannelConfig
to get the SocketOption
fromidleTimeoutMs
- value for IDLE_TIMEOUT
socket optionSocketOption
of type T
or null
if the ChannelConfig
does
not have a value for requested SocketOption
java.lang.IllegalArgumentException
- if the specified SocketOption
is not supported