public HostAndPort getRemoteAddress ( Object client ) { NiftyClientChannel niftyChannel = getNiftyChannel ( client ) ; try { Channel nettyChannel = niftyChannel . getNettyChannel ( ) ; SocketAddress address = nettyChannel . getRemoteAddress ( ) ; InetSocketAddress inetAddress = ( InetSocketAddress ) address ; return HostAndPort . fromParts ( inetAddress . getHostString ( ) , inetAddress . getPort ( ) ) ; } catch ( NullPointerException | ClassCastException e ) { throw new IllegalArgumentException ( "Invalid swift client object" , e ) ; } }
Returns the remote address that a Swift client is connected to