@Override
    public void send(Send request) {
      if (request instanceof ReplicaMetadataRequest) {
        metadataRequest = (ReplicaMetadataRequest) request;
        host.replicaCountPerRequestTracker.add(metadataRequest.getReplicaMetadataRequestInfoList().size());
      } else if (request instanceof GetRequest) {
        getRequest = (GetRequest) request;
        buffersToReturn = new ArrayList<>();
        infosToReturn = new HashMap<>();
        messageMetadatasToReturn = new HashMap<>();
        boolean requestIsEmpty = true;
        for (PartitionRequestInfo partitionRequestInfo : getRequest.getPartitionInfoList()) {
          PartitionId partitionId = partitionRequestInfo.getPartition();
          List<ByteBuffer> bufferList = host.buffersByPartition.get(partitionId);
          List<MessageInfo> messageInfoList = host.infosByPartition.get(partitionId);
          infosToReturn.put(partitionId, new ArrayList<>());
          messageMetadatasToReturn.put(partitionId, new ArrayList<>());
          List<StoreKey> convertedKeys = partitionRequestInfo.getBlobIds()
              .stream()
              .map(k -> conversionMap.getOrDefault(k, k))
              .collect(Collectors.toList());
          List<StoreKey> dedupKeys = convertedKeys.stream().distinct().collect(Collectors.toList());
          for (StoreKey key : dedupKeys) {
            requestIsEmpty = false;
            int index = 0;
            MessageInfo infoFound = null;
            for (MessageInfo info : messageInfoList) {
              if (key.equals(info.getStoreKey())) {
                infoFound = getMergedMessageInfo(info.getStoreKey(), messageInfoList);
                messageMetadatasToReturn.get(partitionId).add(null);
                buffersToReturn.add(bufferList.get(index));
                break;
              }
              index++;
            }
            if (infoFound != null) {
              // If MsgInfo says it is deleted, get the original Put Message's MessageInfo as that is what Get Request
              // looks for. Just set the deleted flag to true for the constructed MessageInfo from Put.
              if (infoFound.isDeleted()) {
                MessageInfo putMsgInfo = getMessageInfo(infoFound.getStoreKey(), messageInfoList, false, false, false);
                infoFound = new MessageInfo(putMsgInfo.getStoreKey(), putMsgInfo.getSize(), true, false, false,
                    putMsgInfo.getExpirationTimeInMs(), null, putMsgInfo.getAccountId(), putMsgInfo.getContainerId(),
                    putMsgInfo.getOperationTimeMs(), infoFound.getLifeVersion());
              } else if (infoFound.isUndeleted()) {
                MessageInfo putMsgInfo = getMessageInfo(infoFound.getStoreKey(), messageInfoList, false, false, false);
                infoFound = new MessageInfo(putMsgInfo.getStoreKey(), putMsgInfo.getSize(), false, false, true,
                    putMsgInfo.getExpirationTimeInMs(), null, putMsgInfo.getAccountId(), putMsgInfo.getContainerId(),
                    putMsgInfo.getOperationTimeMs(), infoFound.getLifeVersion());
              }
              infosToReturn.get(partitionId).add(infoFound);
            }
          }
        }
        assertFalse("Replication should not make empty GetRequests", requestIsEmpty);
      }
    }
Implementation of {@link ConnectedChannel} that fetches message infos or blobs based on the type of request.
ambry-replication/src/test/java/com/github/ambry/replication/MockConnectionPool.java