code: void waitForIO(int ops) throws IOException {
      
      if (selector.select(channel, ops, timeout) == 0) {
        throw new SocketTimeoutException(timeoutExceptionString(channel, timeout,
                                                                ops)); 
      }
    }
docs: This is similar to {@link #doIO(ByteBuffer, int)} except that it
  does not perform any I/O. It just waits for the channel to be ready
  for I/O as specified in ops.
  
  @param ops Selection Ops used for waiting
  
  @throws SocketTimeoutException
  if select on the channel times out.
  @throws IOException
  if any other I/O error occurs.