SocketAddress getRemoteSocketAddress ( ) { // a lot could go wrong here, so rather than put in a bunch of code // to check for nulls all down the chain let's do it the simple // yet bulletproof way try { return ( ( SocketChannel ) sendThread . sockKey . channel ( ) ) . socket ( ) . getRemoteSocketAddress ( ) ; } catch ( NullPointerException e ) { return null ; } }
Returns the address to which the socket is connected .