W
- The type of objects written to this client.R
- The type of objects read from this client.public abstract class TcpClient<W,R> extends InterceptingTcpClient<W,R>
Constructor and Description |
---|
TcpClient() |
Modifier and Type | Method and Description |
---|---|
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerAfter(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerAfter(java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerBefore(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerBefore(java.lang.String baseName,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerFirst(java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <WW,RR> TcpClient<WW,RR> |
addChannelHandlerLast(java.lang.String name,
rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
Adds a
ChannelHandler to ChannelPipeline for all connections created by this client. |
abstract <T> TcpClient<W,R> |
channelOption(io.netty.channel.ChannelOption<T> option,
T value)
Creates a new client instances, inheriting all configurations from this client and adding a
ChannelOption for the connections created by the newly created client instance. |
abstract TcpClient<W,R> |
channelProvider(io.reactivex.netty.client.ChannelProviderFactory providerFactory)
Creates a new client instance, inheriting all configurations from this client and using the passed
providerFactory . |
abstract TcpClient<W,R> |
enableWireLogging(io.netty.handler.logging.LogLevel wireLoggingLevel)
Creates a new client instances, inheriting all configurations from this client and enabling wire logging at the
passed level for the newly created client instance.
|
static TcpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> |
newClient(io.reactivex.netty.client.ConnectionProviderFactory<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> providerFactory,
rx.Observable<io.reactivex.netty.client.Host> hostStream)
Creates a new TCP client instance using the supplied connection provider.
|
static TcpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> |
newClient(java.net.SocketAddress serverAddress)
Creates a new TCP client instance with the passed address of the target server.
|
static TcpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> |
newClient(java.lang.String host,
int port)
Creates a new TCP client instance with the passed address of the target server.
|
abstract <WW,RR> TcpClient<WW,RR> |
pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
Creates a new client instances, inheriting all configurations from this client and using the passed
action to configure all the connections created by the newly created client instance.
|
abstract TcpClient<W,R> |
readTimeOut(int timeOut,
java.util.concurrent.TimeUnit timeUnit)
Creates a new client instances, inheriting all configurations from this client and enables read timeout for all
the connection created by this client.
|
abstract TcpClient<W,R> |
secure(rx.functions.Func1<io.netty.buffer.ByteBufAllocator,javax.net.ssl.SSLEngine> sslEngineFactory)
Creates a new client instance, inheriting all configurations from this client and using the passed
sslEngineFactory for all secured connections created by the newly created client instance. |
abstract TcpClient<W,R> |
secure(io.reactivex.netty.ssl.SslCodec sslCodec)
Creates a new client instance, inheriting all configurations from this client and using the passed
sslCodec for all secured connections created by the newly created client instance. |
abstract TcpClient<W,R> |
secure(javax.net.ssl.SSLEngine sslEngine)
Creates a new client instance, inheriting all configurations from this client and using the passed
sslEngine for all secured connections created by the newly created client instance. |
abstract TcpClient<W,R> |
unsafeSecure()
Creates a new client instance, inheriting all configurations from this client and using a trust-all
TrustManagerFactory for all secured connections created by the newly created client instance. |
createConnectionRequest, intercept
public abstract <T> TcpClient<W,R> channelOption(io.netty.channel.ChannelOption<T> option, T value)
ChannelOption
for the connections created by the newly created client instance.option
- Option to add.value
- Value for the option.TcpClient
instance.public abstract TcpClient<W,R> readTimeOut(int timeOut, java.util.concurrent.TimeUnit timeUnit)
timeOut
- Read timeout duration.timeUnit
- Read timeout time unit.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerFirst(java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added at the first position of the pipeline as specified by
ChannelPipeline.addFirst(String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.name
- Name of the handler.handlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added at the first position of the pipeline as specified by
ChannelPipeline.addFirst(EventExecutorGroup, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsname
- the name of the handler to appendhandlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerLast(java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added at the last position of the pipeline as specified by
ChannelPipeline.addLast(String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.name
- Name of the handler.handlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added at the last position of the pipeline as specified by
ChannelPipeline.addLast(EventExecutorGroup, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsname
- the name of the handler to appendhandlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerBefore(java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added before an existing handler with the passed baseName
in the pipeline as specified by
ChannelPipeline.addBefore(String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.baseName
- the name of the existing handlername
- Name of the handler.handlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerBefore(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added before an existing handler with the passed baseName
in the pipeline as specified by
ChannelPipeline.addBefore(EventExecutorGroup, String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsbaseName
- the name of the existing handlername
- the name of the handler to appendhandlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerAfter(java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added after an existing handler with the passed baseName
in the pipeline as specified by
ChannelPipeline.addAfter(String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.baseName
- the name of the existing handlername
- Name of the handler.handlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> addChannelHandlerAfter(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String baseName, java.lang.String name, rx.functions.Func0<io.netty.channel.ChannelHandler> handlerFactory)
ChannelHandler
to ChannelPipeline
for all connections created by this client. The specified
handler is added after an existing handler with the passed baseName
in the pipeline as specified by
ChannelPipeline.addAfter(EventExecutorGroup, String, String, ChannelHandler)
For better flexibility of pipeline modification, the method pipelineConfigurator(Action1)
will be more
convenient.group
- the EventExecutorGroup
which will be used to execute the ChannelHandler
methodsbaseName
- the name of the existing handlername
- the name of the handler to appendhandlerFactory
- Factory to create handler instance to add.TcpClient
instance.public abstract <WW,RR> TcpClient<WW,RR> pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
pipelineConfigurator
- Action to configure ChannelPipeline
.TcpClient
instance.public abstract TcpClient<W,R> enableWireLogging(io.netty.handler.logging.LogLevel wireLoggingLevel)
wireLoggingLevel
- Logging level at which the wire logs will be logged. The wire logging will only be done if
logging is enabled at this level for LoggingHandler
TcpClient
instance.public abstract TcpClient<W,R> secure(rx.functions.Func1<io.netty.buffer.ByteBufAllocator,javax.net.ssl.SSLEngine> sslEngineFactory)
sslEngineFactory
for all secured connections created by the newly created client instance.
If the SSLEngine
instance can be statically, created, secure(SSLEngine)
can be used.sslEngineFactory
- Factory for all secured connections created by the newly created client instance.TcpClient
instance.public abstract TcpClient<W,R> secure(javax.net.ssl.SSLEngine sslEngine)
sslEngine
for all secured connections created by the newly created client instance.
If the SSLEngine
instance can not be statically, created, secure(Func1)
)} can be used.sslEngine
- SSLEngine
for all secured connections created by the newly created client instance.TcpClient
instance.public abstract TcpClient<W,R> secure(io.reactivex.netty.ssl.SslCodec sslCodec)
sslCodec
for all secured connections created by the newly created client instance.
This is required only when the SslHandler
used by SslCodec
is to be modified before adding to
the ChannelPipeline
. For most of the cases, secure(Func1)
or secure(SSLEngine)
will be
enough.sslCodec
- SslCodec
for all secured connections created by the newly created client instance.TcpClient
instance.public abstract TcpClient<W,R> unsafeSecure()
TrustManagerFactory
for all secured connections created by the newly created client instance.
This is only for testing and should not be used for real production clients.TcpClient
instance.public abstract TcpClient<W,R> channelProvider(io.reactivex.netty.client.ChannelProviderFactory providerFactory)
providerFactory
.providerFactory
- Channel provider factory.TcpClient
instance.public static TcpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> newClient(java.lang.String host, int port)
host
- Hostname for the target server.port
- Port for the target server.TcpClient
instance.public static TcpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> newClient(java.net.SocketAddress serverAddress)
serverAddress
- Socket address for the target server.TcpClient
instance.public static TcpClient<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> newClient(io.reactivex.netty.client.ConnectionProviderFactory<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> providerFactory, rx.Observable<io.reactivex.netty.client.Host> hostStream)
providerFactory
- ConnectionProviderFactory
for the client.hostStream
- Stream of hosts for the client.TcpClient
instance.