Class TcpConnector
java.lang.Object
io.servicetalk.tcp.netty.internal.TcpConnector
Utility class for TCP clients to connect.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <C extends ListenableAsyncCloseable>
Single<C>connect
(SocketAddress localAddress, Object resolvedRemoteAddress, ReadOnlyTcpClientConfig config, boolean autoRead, ExecutionContext<?> executionContext, BiFunction<io.netty.channel.Channel, ConnectionObserver, Single<? extends C>> connectionFactory, TransportObserver observer) Connects to the passedresolvedRemoteAddress
address, resolving the address, if required.
-
Method Details
-
connect
public static <C extends ListenableAsyncCloseable> Single<C> connect(@Nullable SocketAddress localAddress, Object resolvedRemoteAddress, ReadOnlyTcpClientConfig config, boolean autoRead, ExecutionContext<?> executionContext, BiFunction<io.netty.channel.Channel, ConnectionObserver, Single<? extends C>> connectionFactory, TransportObserver observer) Connects to the passedresolvedRemoteAddress
address, resolving the address, if required.- Type Parameters:
C
- Type of the created connection.- Parameters:
localAddress
- The local address to bind to, ornull
.resolvedRemoteAddress
- The address to connect to. This address should already be resolved at this point.config
- TheReadOnlyTcpClientConfig
to use while connecting.autoRead
- iftrue
auto read will be enabled for newChannel
s.executionContext
- TheExecutionContext
to use for the returnedNettyConnection
.connectionFactory
-BiFunction
to create aNettyConnection
asynchronously.observer
-TransportObserver
to use for new connections.- Returns:
- A
Single
that completes with a newChannel
when connected.
-