@Test
  public void testReplicateBlobSuccess() throws Exception {
    Assume.assumeTrue(
        MessageFormatRecord.getCurrentMessageHeaderVersion() >= MessageFormatRecord.Message_Header_Version_V3);
    Map<DataNodeId, MockHost> hosts = new HashMap<>();
    MockPartitionId partitionId =
        (MockPartitionId) clusterMap.getWritablePartitionIds(MockClusterMap.DEFAULT_PARTITION_CLASS).get(0);
    MockHost remoteHost = null;
    for (ReplicaId replica : partitionId.getReplicaIds()) {
      MockHost host = new MockHost(replica.getDataNodeId(), clusterMap);
      if (dataNodeId != host.dataNodeId && remoteHost == null) {
        remoteHost = host;
      }
      hosts.put(host.dataNodeId, host);
    }
    StoreKey storeKey = addPutMessagesToReplicasOfPartition(partitionId, Arrays.asList(remoteHost), 1).get(0);

    MockConnectionPool connectionPool = new MockConnectionPool(hosts, clusterMap, 5);
    ambryRequests = new AmbryServerRequests(storageManager, requestResponseChannel, clusterMap, dataNodeId,
        clusterMap.getMetricRegistry(), serverMetrics, findTokenHelper, null, replicationManager, storeKeyFactory,
        serverConfig, diskManagerConfig, storeKeyConverterFactory, statsManager, helixParticipant, connectionPool);

    int correlationId = TestUtils.RANDOM.nextInt();
    String clientId = TestUtils.getRandomString(10);
    BlobId blobId = (BlobId) storeKey;

    ReplicateBlobRequest request =
        new ReplicateBlobRequest(correlationId, clientId, blobId, remoteHost.dataNodeId.getHostname(),
            remoteHost.dataNodeId.getPort());

    storageManager.resetStore();
    Response response = sendRequestGetResponse(request, ServerErrorCode.NoError);
    assertEquals("Operation received at the store not as expected", RequestOrResponseType.PutRequest,
        MockStorageManager.operationReceived);
    ReplicateBlobResponse replicateBlobResponse = (ReplicateBlobResponse) response;
    assertEquals("expect ReplicateBlobRequest is successful. ", replicateBlobResponse.getError(),
        ServerErrorCode.NoError);
  }
Tests success case for ReplicateBlobRequest.
Should replicate the PutBlob from the remote host.
ambry-server/src/test/java/com/github/ambry/server/AmbryServerRequestsTest.java