public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos, Set<Integer> requestsToDrop,
      int pollTimeoutMs) {
    if (closed) {
      throw new IllegalStateException("The client is closed.");
    }

    // TODO: do anything with requestsToDrop?
    // The AmbryRequest sessions run in a thread pool, and each thread knows when the response is back so we can poll it
    long startTime = time.milliseconds();
    for (RequestInfo requestInfo : requestInfos) {
      // Request is sent and received as it is without serializing to stream since they are handled in same process via
      // local queues.
      try {
        requestInfo.setRequestEnqueueTime(time.milliseconds());
        channel.sendRequest(new LocalChannelRequest(requestInfo, processorId));
      } catch (Exception e) {
        logger.error("Received an unexpected error during sendAndPoll(): ", e);
        // release related bytebuf
        requestInfo.getRequest().release();
        networkMetrics.networkClientException.inc();
      }
    }

    List<ResponseInfo> responses = channel.receiveResponses(processorId, pollTimeoutMs);
    networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime, TimeUnit.MILLISECONDS);
    return responses;
  }
Attempt to send the given requests and poll for responses from the network via the associated channel. Any
requests that could not be sent out will be added to a queue. Every time this method is called, it will first
attempt sending the requests in the queue (or time them out) and then attempt sending the newly added requests.
@param requestInfos the list of {@link RequestInfo} representing the requests that need to be sent out. This
                    could be empty.
@param requestsToDrop the list of correlation IDs representing the requests that can be dropped by
                      closing the connection.
@param pollTimeoutMs the poll timeout.
@return a list of {@link ResponseInfo} representing the responses received for any requests that were sent out
so far.
@throws IllegalStateException if the client is closed.
ambry-network/src/main/java/com/github/ambry/network/LocalNetworkClient.java