code: public void throwIfReached() throws IOException {
      if (Thread.interrupted()) {
        throw new InterruptedIOException("thread interrupted");
      }
  
      if (hasDeadline && deadlineNanoTime - System.nanoTime() <= 0) {
        throw new InterruptedIOException("deadline reached");
      }
    }
docs: Throws an {@link InterruptedIOException} if the deadline has been reached or if the current
  thread has been interrupted. This method doesn't detect timeouts; that should be implemented to
  asynchronously abort an in-progress operation.