code: public final Sink sink(final Sink sink) {
      return new Sink() {
        @Override public void write(Buffer source, long byteCount) throws IOException {
          boolean throwOnTimeout = false;
          enter();
          try {
            sink.write(source, byteCount);
            throwOnTimeout = true;
          } catch (IOException e) {
            throw exit(e);
          } finally {
            exit(throwOnTimeout);
          }
        }
  
        @Override public void flush() throws IOException {
          boolean throwOnTimeout = false;
          enter();
          try {
            sink.flush();
            throwOnTimeout = true;
          } catch (IOException e) {
            throw exit(e);
          } finally {
            exit(throwOnTimeout);
          }
        }
  
        @Override public void close() throws IOException {
          boolean throwOnTimeout = false;
          enter();
          try {
            sink.close();
            throwOnTimeout = true;
          } catch (IOException e) {
            throw exit(e);
          } finally {
            exit(throwOnTimeout);
          }
        }
  
        @Override public Timeout timeout() {
          return AsyncTimeout.this;
        }
  
        @Override public String toString() {
          return "AsyncTimeout.sink(" + sink + ")";
        }
      };
    }
docs: Returns a new sink that delegates to {@code sink}, using this to implement
  timeouts. This works best if {@link #timedOut} is overridden to interrupt
  {@code sink}'s current operation.