public final class TcpServerBinder
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends ConnectionContext> |
bind(java.net.SocketAddress listenAddress,
ReadOnlyTcpServerConfig config,
boolean autoRead,
ExecutionContext executionContext,
ConnectionAcceptor connectionAcceptor,
java.util.function.Function<io.netty.channel.Channel,Single<T>> connectionFunction,
java.util.function.Consumer<T> connectionConsumer)
Create a
ServerContext that represents a socket which is bound and listening on the
listenAddress. |
public static <T extends ConnectionContext> Single<ServerContext> bind(java.net.SocketAddress listenAddress, ReadOnlyTcpServerConfig config, boolean autoRead, ExecutionContext executionContext, @Nullable ConnectionAcceptor connectionAcceptor, java.util.function.Function<io.netty.channel.Channel,Single<T>> connectionFunction, java.util.function.Consumer<T> connectionConsumer)
ServerContext that represents a socket which is bound and listening on the
listenAddress.T - The type of ConnectionContext that is created for each accepted socket.listenAddress - The address to bind to.config - The ReadOnlyTcpServerConfig to use for the bind socket and newly accepted sockets.autoRead - if true auto read will be enabled for new Channels.executionContext - The ExecutionContext to use for the bind socket.connectionAcceptor - The ConnectionAcceptor used to filter newly accepted sockets.connectionFunction - Used to create a new NettyConnection from a Channel.connectionConsumer - Used to consume the result of connectionFunction after initialization and
filtering is done. This can be used for protocol specific initialization and to start data flow.Single that completes with a ServerContext that represents a socket which is bound and
listening on the listenAddress.