code: public boolean isValid(final int timeout) throws SQLException {
      if (timeout < 0) {
        throw new SQLException("the value supplied for timeout is negative");
      }
      if (isClosed()) {
        return false;
      }
  
      try {
        return protocol.isValid(timeout * 1000);
      } catch (SQLException e) {
        ExceptionMapper.checkConnectionException(e, this);
        return false;
      }
    }
docs: <p>Returns true if the connection has not been closed and is still valid. The driver shall
  submit a query on the connection or use some other mechanism that positively verifies the
  connection is still valid when this method is called.</p>
  <p>The query submitted by the driver to validate the connection shall be executed in the
  context of the current transaction.</p>
  
  @param timeout - The time in seconds to wait for the database operation used to validate the
  connection to complete. If the timeout period expires before the operation
  completes, this method returns false.  A value of 0 indicates a timeout is not
  applied to the database operation.
  @return true if the connection is valid, false otherwise
  @throws SQLException if the value supplied for <code>timeout</code> is less then 0
  @see DatabaseMetaData#getClientInfoProperties
  @since 1.6