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 aServerContext
that 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 aServerContext
that represents a socket which is bound and listening on thelistenAddress
.- Type Parameters:
CC
- The type ofConnectionContext
that is created for each accepted socket.- Parameters:
listenAddress
- The address to bind to.config
- TheReadOnlyTcpServerConfig
to use for the bind socket and newly accepted sockets.autoRead
- iftrue
auto read will be enabled for newChannel
s.executionContext
- TheExecutionContext
to use for the bind socket.connectionAcceptor
- TheConnectionAcceptor
used to filter newly accepted sockets.connectionFunction
- Used to create a newNettyConnection
from aChannel
.connectionConsumer
- Used to consume the result ofconnectionFunction
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 aServerContext
that 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 aServerContext
that represents a socket which is bound and listening on thelistenAddress
.- Type Parameters:
CC
- The type ofConnectionContext
that is created for each accepted socket.- Parameters:
listenAddress
- The address to bind to.config
- TheReadOnlyTcpServerConfig
to use for the bind socket and newly accepted sockets.executionContext
- TheExecutionContext
to use for the bind socket.connectionAcceptor
- TheConnectionAcceptor
used to filter newly accepted sockets.connectionFunction
- Used to create a newNettyConnection
from aChannel
.connectionConsumer
- Used to consume the result ofconnectionFunction
after initialization and filtering is done. This can be used for protocol specific initialization and to start data flow.earlyConnectionAcceptor
- theEarlyConnectionAcceptor
to filter newly accepted sockets early.lateConnectionAcceptor
- theLateConnectionAcceptor
to filter newly accepted sockets.- Returns:
- a
Single
that completes with aServerContext
that represents a socket which is bound and listening on thelistenAddress
.
-