code: public void cancel() {
      Exchange exchangeToCancel;
      RealConnection connectionToCancel;
      synchronized (connectionPool) {
        canceled = true;
        exchangeToCancel = exchange;
        connectionToCancel = exchangeFinder != null && exchangeFinder.connectingConnection() != null
            ? exchangeFinder.connectingConnection()
            : connection;
      }
      if (exchangeToCancel != null) {
        exchangeToCancel.cancel();
      } else if (connectionToCancel != null) {
        connectionToCancel.cancel();
      }
    }
docs: Immediately closes the socket connection if it's currently held. Use this to interrupt an
  in-flight request from any thread. It's the caller's responsibility to close the request body
  and response body streams; otherwise resources may be leaked.
  
  <p>This method is safe to be called concurrently, but provides limited guarantees. If a
  transport layer connection has been established (such as a HTTP/2 stream) that is terminated.
  Otherwise if a socket connection is being established, that is terminated.