Class TcpServerBinder
java.lang.Object
io.servicetalk.tcp.netty.internal.TcpServerBinder
Utility class to start a TCP based server.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <CC extends ConnectionContext>
Single<ServerContext>bind(SocketAddress listenAddress, ReadOnlyTcpServerConfig config, boolean autoRead, ExecutionContext<?> executionContext, InfluencerConnectionAcceptor connectionAcceptor, BiFunction<io.netty.channel.Channel, ConnectionObserver, Single<CC>> connectionFunction, Consumer<CC> connectionConsumer) Deprecated.use the bind method with early and late acceptors instead.static <CC extends ConnectionContext>
Single<ServerContext>bind(SocketAddress listenAddress, ReadOnlyTcpServerConfig config, ExecutionContext<?> executionContext, InfluencerConnectionAcceptor connectionAcceptor, BiFunction<io.netty.channel.Channel, ConnectionObserver, Single<CC>> connectionFunction, Consumer<CC> connectionConsumer, EarlyConnectionAcceptor earlyConnectionAcceptor, LateConnectionAcceptor lateConnectionAcceptor) Create aServerContextthat represents a socket which is bound and listening on thelistenAddress.
-
Method Details
-
bind
@Deprecated public static <CC extends ConnectionContext> Single<ServerContext> bind(SocketAddress listenAddress, ReadOnlyTcpServerConfig config, boolean autoRead, ExecutionContext<?> executionContext, @Nullable InfluencerConnectionAcceptor connectionAcceptor, BiFunction<io.netty.channel.Channel, ConnectionObserver, Single<CC>> connectionFunction, Consumer<CC> connectionConsumer) Deprecated.use the bind method with early and late acceptors instead.Create aServerContextthat represents a socket which is bound and listening on thelistenAddress.- Type Parameters:
CC- The type ofConnectionContextthat is created for each accepted socket.- Parameters:
listenAddress- The address to bind to.config- TheReadOnlyTcpServerConfigto use for the bind socket and newly accepted sockets.autoRead- iftrueauto read will be enabled for newChannels.executionContext- TheExecutionContextto use for the bind socket.connectionAcceptor- TheConnectionAcceptorused to filter newly accepted sockets.connectionFunction- Used to create a newNettyConnectionfrom aChannel.connectionConsumer- Used to consume the result ofconnectionFunctionafter initialization and filtering is done. This can be used for protocol specific initialization and to start data flow.- Returns:
- a
Singlethat completes with aServerContextthat represents a socket which is bound and listening on thelistenAddress.
-
bind
public static <CC extends ConnectionContext> Single<ServerContext> bind(SocketAddress listenAddress, ReadOnlyTcpServerConfig config, ExecutionContext<?> executionContext, @Nullable InfluencerConnectionAcceptor connectionAcceptor, BiFunction<io.netty.channel.Channel, ConnectionObserver, Single<CC>> connectionFunction, Consumer<CC> connectionConsumer, @Nullable EarlyConnectionAcceptor earlyConnectionAcceptor, @Nullable LateConnectionAcceptor lateConnectionAcceptor) Create aServerContextthat represents a socket which is bound and listening on thelistenAddress.- Type Parameters:
CC- The type ofConnectionContextthat is created for each accepted socket.- Parameters:
listenAddress- The address to bind to.config- TheReadOnlyTcpServerConfigto use for the bind socket and newly accepted sockets.executionContext- TheExecutionContextto use for the bind socket.connectionAcceptor- TheConnectionAcceptorused to filter newly accepted sockets.connectionFunction- Used to create a newNettyConnectionfrom aChannel.connectionConsumer- Used to consume the result ofconnectionFunctionafter initialization and filtering is done. This can be used for protocol specific initialization and to start data flow.earlyConnectionAcceptor- theEarlyConnectionAcceptorto filter newly accepted sockets early.lateConnectionAcceptor- theLateConnectionAcceptorto filter newly accepted sockets.- Returns:
- a
Singlethat completes with aServerContextthat represents a socket which is bound and listening on thelistenAddress.
-