public boolean isHealthy ( boolean doExtensiveChecks ) { if ( socket . isClosed ( ) || socket . isInputShutdown ( ) || socket . isOutputShutdown ( ) ) { return false ; } if ( http2Connection != null ) { return ! http2Connection . isShutdown ( ) ; } if ( doExtensiveChecks ) { try { int readTimeout = socket . getSoTimeout ( ) ; try { socket . setSoTimeout ( 1 ) ; if ( source . exhausted ( ) ) { return false ; // Stream is exhausted; socket is closed. } return true ; } finally { socket . setSoTimeout ( readTimeout ) ; } } catch ( SocketTimeoutException ignored ) { // Read timed out; socket is good. } catch ( IOException e ) { return false ; // Couldn't read; socket is closed. } } return true ; }
Returns true if this connection is ready to host new streams .