code: public synchronized Headers takeHeaders() throws IOException {
      readTimeout.enter();
      try {
        while (headersQueue.isEmpty() && errorCode == null) {
          waitForIo();
        }
      } finally {
        readTimeout.exitAndThrowIfTimedOut();
      }
      if (!headersQueue.isEmpty()) {
        return headersQueue.removeFirst();
      }
      throw errorException != null ? errorException : new StreamResetException(errorCode);
    }
docs: Removes and returns the stream's received response headers, blocking if necessary until headers
  have been received. If the returned list contains multiple blocks of headers the blocks will be
  delimited by 'null'.