public abstract class DynamicAddressConnectHandler extends ChannelOutboundHandlerAdapter
ChannelOutboundHandler implementation which allows to dynamically replace the used
remoteAddress and / or localAddress when making a connection attempt.
This can be useful to for example bind to a specific NetworkInterface based on
the remoteAddress.
ChannelHandler.Sharable| 构造器和说明 |
|---|
DynamicAddressConnectHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
connect(ChannelHandlerContext ctx,
java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
ChannelPromise promise)
Calls
ChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline. |
protected java.net.SocketAddress |
localAddress(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Returns the local
SocketAddress to use for
ChannelOutboundInvoker.connect(SocketAddress, SocketAddress) based on the original remoteAddress
and localAddress. |
protected java.net.SocketAddress |
remoteAddress(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Returns the remote
SocketAddress to use for
ChannelOutboundInvoker.connect(SocketAddress, SocketAddress) based on the original remoteAddress
and localAddress. |
bind, close, deregister, disconnect, flush, read, writeensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedpublic final void connect(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
ChannelOutboundHandlerAdapterChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.connect 在接口中 ChannelOutboundHandlerconnect 在类中 ChannelOutboundHandlerAdapterctx - the ChannelHandlerContext for which the connect operation is maderemoteAddress - the SocketAddress to which it should connectlocalAddress - the SocketAddress which is used as source on connectpromise - the ChannelPromise to notify once the operation completesprotected java.net.SocketAddress localAddress(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
throws java.lang.Exception
SocketAddress to use for
ChannelOutboundInvoker.connect(SocketAddress, SocketAddress) based on the original remoteAddress
and localAddress.
By default, this method returns the given localAddress.java.lang.Exceptionprotected java.net.SocketAddress remoteAddress(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
throws java.lang.Exception
SocketAddress to use for
ChannelOutboundInvoker.connect(SocketAddress, SocketAddress) based on the original remoteAddress
and localAddress.
By default, this method returns the given remoteAddress.java.lang.Exception