- 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
ChannelHandlerimplementation which allows to dynamically replace the usedremoteAddressand / orlocalAddresswhen making a connection attempt.This can be useful to for example bind to a specific
NetworkInterfacebased 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 SocketAddresslocalAddress(SocketAddress remoteAddress, SocketAddress localAddress)Returns the localSocketAddressto use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)based on the originalremoteAddressandlocalAddress.protected SocketAddressremoteAddress(SocketAddress remoteAddress, SocketAddress localAddress)Returns the remoteSocketAddressto use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)based on the originalremoteAddressandlocalAddress.-
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:
connectin interfaceio.netty5.channel.ChannelHandler
-
localAddress
protected SocketAddress localAddress(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
Returns the localSocketAddressto use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)based on the originalremoteAddressandlocalAddress. By default, this method returns the givenlocalAddress.- Throws:
Exception
-
remoteAddress
protected SocketAddress remoteAddress(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
Returns the remoteSocketAddressto use forChannelOutboundInvoker.connect(SocketAddress, SocketAddress)based on the originalremoteAddressandlocalAddress. By default, this method returns the givenremoteAddress.- Throws:
Exception
-
-