larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/connection/RealConnection.java
public boolean isHealthy(boolean doExtensiveChecks) {
    if (socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) {
      return false;
    }

    if (http2Connection != null) {
      return http2Connection.isHealthy(System.nanoTime());
    }

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