public void checkConnection ( ) { long start = Time . currentTimeMillis ( ) ; while ( clientChannel == null ) { tcpSocketConsumer . checkNotShutdown ( ) ; if ( start + timeoutMs > Time . currentTimeMillis ( ) ) try { condition . await ( 1 , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { throw new IORuntimeException ( "Interrupted" ) ; } else throw new IORuntimeException ( "Not connected to " + socketAddressSupplier ) ; } if ( clientChannel == null ) throw new IORuntimeException ( "Not connected to " + socketAddressSupplier ) ; }
blocks until there is a connection