- java.lang.Object
-
- io.netty5.handler.address.DynamicAddressConnectHandler
-
- All Implemented Interfaces:
io.netty5.channel.ChannelHandler
public abstract class DynamicAddressConnectHandler extends Object implements io.netty5.channel.ChannelHandler
ChannelHandler
implementation which allows to dynamically replace the usedremoteAddress
and / orlocalAddress
when making a connection attempt.This can be useful to for example bind to a specific
NetworkInterface
based on theremoteAddress
.
-
-
Constructor Summary
Constructors Constructor Description DynamicAddressConnectHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty5.util.concurrent.Future<Void>
connect(io.netty5.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress)
protected SocketAddress
localAddress(SocketAddress remoteAddress, SocketAddress localAddress)
Returns the localSocketAddress
to use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)
based on the originalremoteAddress
andlocalAddress
.protected SocketAddress
remoteAddress(SocketAddress remoteAddress, SocketAddress localAddress)
Returns the remoteSocketAddress
to use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)
based on the originalremoteAddress
andlocalAddress
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInactive, channelInboundEvent, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, deregister, disconnect, flush, handlerAdded, handlerRemoved, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
-
-
-
-
Method Detail
-
connect
public final io.netty5.util.concurrent.Future<Void> connect(io.netty5.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress)
- Specified by:
connect
in interfaceio.netty5.channel.ChannelHandler
-
localAddress
protected SocketAddress localAddress(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
Returns the localSocketAddress
to use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)
based on the originalremoteAddress
andlocalAddress
. By default, this method returns the givenlocalAddress
.- Throws:
Exception
-
remoteAddress
protected SocketAddress remoteAddress(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
Returns the remoteSocketAddress
to use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)
based on the originalremoteAddress
andlocalAddress
. By default, this method returns the givenremoteAddress
.- Throws:
Exception
-
-