public class TcpClient extends Object implements NettyConnector<NettyInbound,NettyOutbound>
| Modifier and Type | Field and Description |
|---|---|
protected static ChannelOperations.OnNew |
EMPTY |
| Modifier | Constructor and Description |
|---|---|
protected |
TcpClient(ClientOptions options) |
| Modifier and Type | Method and Description |
|---|---|
static TcpClient |
create()
Bind a new TCP client to the localhost on
port 12012. |
static TcpClient |
create(java.util.function.Consumer<? super ClientOptions> options)
Bind a new TCP client to the specified connect address and port.
|
static TcpClient |
create(int port)
Bind a new TCP client to "localhost" on the the specified port.
|
static TcpClient |
create(String bindAddress)
Bind a new TCP client to the specified connect address and
port 12012. |
static TcpClient |
create(String bindAddress,
int port)
Bind a new TCP client to the specified connect address and port.
|
protected ContextHandler<SocketChannel> |
doHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<Void>> handler,
MonoSink<NettyContext> sink,
boolean secure,
SocketAddress providedAddress,
ChannelPool pool,
java.util.function.Consumer<? super Channel> onSetup)
Create a
ContextHandler for AbstractBootstrap.handler() |
Mono<? extends NettyContext> |
newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<Void>> handler) |
protected Mono<NettyContext> |
newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<Void>> handler,
InetSocketAddress address,
boolean secure,
java.util.function.Consumer<? super Channel> onSetup) |
ClientOptions |
options()
Get the
ClientOptions currently in effect. |
String |
toString() |
protected static final ChannelOperations.OnNew EMPTY
protected TcpClient(ClientOptions options)
public static TcpClient create()
port 12012.
The type of emitted data or received data is ByteBuf
TcpClientpublic static TcpClient create(String bindAddress)
port 12012.
The type of emitted data or received data is ByteBuf
bindAddress - the address to connect to on port 12012
a new TcpClient
public static TcpClient create(int port)
The type of emitted data or received data is ByteBuf
port - the port to connect to on "localhost"
a new TcpClient
public static TcpClient create(String bindAddress, int port)
The type of emitted data or received data is ByteBuf
bindAddress - the address to connect toport - the port to connect to
a new TcpClient
public static TcpClient create(java.util.function.Consumer<? super ClientOptions> options)
The type of emitted data or received data is ByteBuf
options - a new TcpClientpublic final ClientOptions options()
ClientOptions currently in effect.public final Mono<? extends NettyContext> newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<Void>> handler)
newHandler in interface Connector<ByteBuf,ByteBuf,NettyInbound,NettyOutbound>protected Mono<NettyContext> newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<Void>> handler, InetSocketAddress address, boolean secure, java.util.function.Consumer<? super Channel> onSetup)
handler - address - secure - onSetup - protected ContextHandler<SocketChannel> doHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<Void>> handler, MonoSink<NettyContext> sink, boolean secure, SocketAddress providedAddress, ChannelPool pool, java.util.function.Consumer<? super Channel> onSetup)
ContextHandler for AbstractBootstrap.handler()handler - user provided in/out handlersink - user provided bind handlersecure - if operation should be securedpool - if channel poolonSetup - if operation has local setup callbackContextHandler