bind
public static <T extends ConnectionContext> Single<ServerContext> bind(java.net.SocketAddress listenAddress,
ReadOnlyTcpServerConfig config,
boolean autoRead,
ExecutionContext executionContext,
@Nullable
ConnectionAcceptor connectionAcceptor,
java.util.function.BiFunction<io.netty.channel.Channel,ConnectionObserver,Single<T>> connectionFunction,
java.util.function.Consumer<T> connectionConsumer)
Create a
ServerContext that represents a socket which is bound and listening on the
listenAddress.
- Type Parameters:
T - The type of ConnectionContext that is created for each accepted socket.
- Parameters:
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.
- Returns:
- a
Single that completes with a ServerContext that represents a socket which is bound and
listening on the listenAddress.