Class TcpConnector


  • public final class TcpConnector
    extends java.lang.Object
    Utility class for TCP clients to connect.
    • Method Detail

      • connect

        public static <C extends ListenableAsyncCloseableSingle<C> connect​(@Nullable
                                                                             java.net.SocketAddress localAddress,
                                                                             java.lang.Object resolvedRemoteAddress,
                                                                             ReadOnlyTcpClientConfig config,
                                                                             boolean autoRead,
                                                                             ExecutionContext executionContext,
                                                                             java.util.function.BiFunction<io.netty.channel.Channel,​ConnectionObserver,​Single<? extends C>> connectionFactory,
                                                                             TransportObserver observer)
        Connects to the passed resolvedRemoteAddress address, resolving the address, if required.
        Type Parameters:
        C - Type of the created connection.
        Parameters:
        localAddress - The local address to bind to, or null.
        resolvedRemoteAddress - The address to connect to. This address should already be resolved at this point.
        config - The ReadOnlyTcpClientConfig to use while connecting.
        autoRead - if true auto read will be enabled for new Channels.
        executionContext - The ExecutionContext to use for the returned NettyConnection.
        connectionFactory - BiFunction to create a NettyConnection asynchronously.
        observer - TransportObserver to use for new connections.
        Returns:
        A Single that completes with a new Channel when connected.