public void initialize ( ) throws IOException , NotInitializedException { logger . debug ( "Initialising TCPTransportClient. Origin address is [{}] and destination address is [{}]" , origAddress , destAddress ) ; if ( destAddress == null ) { throw new NotInitializedException ( "Destination address is not set" ) ; } socketChannel = SelectorProvider . provider ( ) . openSocketChannel ( ) ; try { if ( origAddress != null ) { socketChannel . socket ( ) . bind ( origAddress ) ; } socketChannel . connect ( destAddress ) ; //PCB added logging socketChannel . configureBlocking ( BLOCKING_IO ) ; getParent ( ) . onConnected ( ) ; } catch ( IOException e ) { if ( origAddress != null ) { socketChannel . socket ( ) . close ( ) ; } socketChannel . close ( ) ; throw e ; } }
Network init socket