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 passedresolvedRemoteAddressaddress, 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 passedresolvedRemoteAddressaddress, 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- TheReadOnlyTcpClientConfigto use while connecting.autoRead- iftrueauto read will be enabled for newChannels.executionContext- TheExecutionContextto use for the returnedNettyConnection.connectionFactory-BiFunctionto create aNettyConnectionasynchronously.observer-TransportObserverto use for new connections.- Returns:
- A
Singlethat completes with a newChannelwhen connected.
-