public class TcpClient extends java.lang.Object implements NettyConnector<NettyInbound,NettyOutbound>
| Modifier and Type | Class and Description |
|---|---|
static class |
TcpClient.Builder |
| Modifier and Type | Field and Description |
|---|---|
protected static ChannelOperations.OnNew |
EMPTY |
| Modifier | Constructor and Description |
|---|---|
protected |
TcpClient(ClientOptions options) |
protected |
TcpClient(TcpClient.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
static TcpClient.Builder |
builder()
Creates a builder for
TcpClient |
static TcpClient |
create()
Bind a new TCP client to the localhost on
port 12012. |
static TcpClient |
create(java.util.function.Consumer<? super ClientOptions.Builder<?>> 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(java.lang.String bindAddress)
Bind a new TCP client to the specified connect address and
port 12012. |
static TcpClient |
create(java.lang.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<java.lang.Void>> handler,
MonoSink<NettyContext> sink,
boolean secure,
java.net.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<java.lang.Void>> handler)
Prepare a
BiFunction IO handler that will react on a new connected state
each
time
the returned Mono is subscribed. |
protected Mono<NettyContext> |
newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<java.lang.Void>> handler,
java.net.InetSocketAddress address,
boolean secure,
java.util.function.Consumer<? super Channel> onSetup) |
ClientOptions |
options()
Get a copy of the
ClientOptions currently in effect. |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitstart, start, startAndAwait, startAndAwaitprotected static final ChannelOperations.OnNew EMPTY
protected TcpClient(TcpClient.Builder builder)
protected TcpClient(ClientOptions options)
public static TcpClient create()
port 12012.
The type of emitted data or received data is ByteBuf
TcpClientpublic static TcpClient create(java.lang.String bindAddress)
port 12012.
The type of emitted data or received data is ByteBuf
bindAddress - the address to connect to on port 12012TcpClientpublic static TcpClient create(int port)
The type of emitted data or received data is ByteBuf
port - the port to connect to on "localhost"TcpClientpublic static TcpClient create(java.lang.String bindAddress, int port)
The type of emitted data or received data is ByteBuf
bindAddress - the address to connect toport - the port to connect toTcpClientpublic static TcpClient create(java.util.function.Consumer<? super ClientOptions.Builder<?>> options)
The type of emitted data or received data is ByteBuf
options - ClientOptions configuration inputTcpClientpublic static TcpClient.Builder builder()
TcpClientpublic final Mono<? extends NettyContext> newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<java.lang.Void>> handler)
NettyConnectorBiFunction IO handler that will react on a new connected state
each
time
the returned Mono is subscribed. This NettyConnector shouldn't assume
any state related to the individual created/cleaned resources.
The IO handler will return Publisher to signal when to terminate the
underlying resource channel.
newHandler in interface NettyConnector<NettyInbound,NettyOutbound>handler - the in/out callback returning a closing publisherMono completing with a Disposable token to dispose
the active handler (server, client connection...) or failing with the connection
error.public final ClientOptions options()
ClientOptions currently in effect.public java.lang.String toString()
toString in class java.lang.Objectprotected Mono<NettyContext> newHandler(java.util.function.BiFunction<? super NettyInbound,? super NettyOutbound,? extends Publisher<java.lang.Void>> handler, java.net.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<java.lang.Void>> handler, MonoSink<NettyContext> sink, boolean secure, java.net.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