code: public static boolean skipAll(Source source, int duration, TimeUnit timeUnit) throws IOException {
      long now = System.nanoTime();
      long originalDuration = source.timeout().hasDeadline()
          ? source.timeout().deadlineNanoTime() - now
          : Long.MAX_VALUE;
      source.timeout().deadlineNanoTime(now + Math.min(originalDuration, timeUnit.toNanos(duration)));
      try {
        Buffer skipBuffer = new Buffer();
        while (source.read(skipBuffer, 8192) != -1) {
          skipBuffer.clear();
        }
        return true; // Success! The source has been exhausted.
      } catch (InterruptedIOException e) {
        return false; // We ran out of time before exhausting the source.
      } finally {
        if (originalDuration == Long.MAX_VALUE) {
          source.timeout().clearDeadline();
        } else {
          source.timeout().deadlineNanoTime(now + originalDuration);
        }
      }
    }
docs: Reads until {@code in} is exhausted or the deadline has been reached. This is careful to not
  extend the deadline if one exists already.