question: public ClientMessenger ( final String host , final int port , final String name , final String mac , final IObjectStreamFactory streamFact , final IConnectionLogin login ) throws IOException { m_socketChannel = SocketChannel . open ( ) ; m_socketChannel . configureBlocking ( false ) ; final InetSocketAddress remote = new InetSocketAddress ( host , port ) ; if ( ! m_socketChannel . connect ( remote ) ) { int waitTimeMilliseconds = 0 ; while ( true ) { if ( waitTimeMilliseconds > 10000 ) { m_socketChannel . close ( ) ; throw new IOException ( "Connection refused" ) ; } if ( m_socketChannel . finishConnect ( ) ) { break ; } ThreadUtil . sleep ( 50 ) ; waitTimeMilliseconds += 50 ; } } final Socket socket = m_socketChannel . socket ( ) ; socket . setKeepAlive ( true ) ; m_socket = new NIOSocket ( streamFact , this , name ) ; final ClientQuarantineConversation conversation = new ClientQuarantineConversation ( login , m_socketChannel , m_socket , name , mac ) ; m_socket . add ( m_socketChannel , conversation ) ; conversation . showCredentials ( ) ; try { m_initLatch . await ( ) ; } catch ( final InterruptedException e ) { m_connectionRefusedError = e ; try { m_socketChannel . close ( ) ; } catch ( final IOException e2 ) { } } if ( conversation . getErrorMessage ( ) != null || m_connectionRefusedError != null ) { m_socket . shutDown ( ) ; if ( conversation . getErrorMessage ( ) != null ) { String msg = conversation . getErrorMessage ( ) ; if ( m_connectionRefusedError != null ) { msg += ", " + m_connectionRefusedError ; } login . notifyFailedLogin ( msg ) ; throw new CouldNotLogInException ( ) ; } else if ( m_connectionRefusedError instanceof CouldNotLogInException ) { throw ( CouldNotLogInException ) m_connectionRefusedError ; } else if ( m_connectionRefusedError != null ) { throw new IOException ( m_connectionRefusedError . getMessage ( ) ) ; } } }
target:  Note, the name paramater passed in here may not match the name of the ClientMessenger after it has been constructed.