docs: private void completeResponses() {
      // Iterate through queued responses and complete as many as possible.
      ResponseCallback response = responseCallbacks.get(responseSequence + 1);
      while (response != null) {
        // If the response was completed, remove the response callback from the response queue,
        // increment the response sequence number, and check the next response.
        if (completeResponse(response.response, response.callback)) {
          responseCallbacks.remove(++responseSequence);
          response = responseCallbacks.get(responseSequence + 1);
        } else {
          break;
        }
      }
  
      // Once we've completed as many responses as possible, if no more operations are outstanding
      // and events remain in the event queue, complete the events.
      if (requestSequence == responseSequence) {
        EventCallback eventCallback = eventCallbacks.poll();
        while (eventCallback != null) {
          log.trace("Completing {}", eventCallback.request);
          eventCallback.run();
          eventIndex = eventCallback.request.eventIndex();
          eventCallback = eventCallbacks.poll();
        }
      }
    }