@Test
  public void testBlobTtlUpdate404AndThenRetrySuccess() throws Exception {
    try {
      String updateServiceId = "update-service";
      MockServerLayout layout = new MockServerLayout(mockClusterMap);
      setRouter(getNonBlockingRouterPropertiesForRepairRequests(localDcName, true, false, false), layout,
          new LoggingNotificationSystem());
      setOperationParams();
      String blobId =
          router.putBlob(putBlobProperties, putUserMetadata, putChannel, new PutBlobOptionsBuilder().build())
              .get(AWAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
      assertTtl(router, Collections.singleton(blobId), TimeUnit.DAYS.toSeconds(7));

      // for the three local replicas, two replicas return Blob_Not_Found due to host swap.
      DataNodeId sourceDataNode = null;
      List<ServerErrorCode> serverErrors = new ArrayList<>();
      serverErrors.add(ServerErrorCode.BlobNotFound); // return NOT_FOUND for the first TtlUpdate Request
      for (MockServer server : layout.getMockServers()) {
        if (server.getDataCenter().equals(localDcName)) {
          // local DC, return NO_ERROR for one replica,
          if (sourceDataNode == null) {
            sourceDataNode = mockClusterMap.getDataNodeId(server.getHostName(), server.getHostPort());
          } else {
            server.setServerErrors(serverErrors);
          }
        }
      }
      router.updateBlobTtl(blobId, updateServiceId, Utils.Infinite_Time).get();

      // simulate Replica_Unavailable for the source host node. Read from the other two.
      layout.getMockServers().forEach(mockServer -> mockServer.setServerErrorForAllRequests(null));
      for (MockServer server : layout.getMockServers()) {
        if (server.getHostName().equals(sourceDataNode.getHostname()) && server.getHostPort()
            .equals(sourceDataNode.getPort())) {
          server.setServerErrorForAllRequests(ServerErrorCode.ReplicaUnavailable);
        }
      }
      assertTtl(router, Collections.singleton(blobId), Utils.Infinite_Time);

      layout.getMockServers().forEach(mockServer -> mockServer.setServerErrorForAllRequests(null));
    } finally {
      // Since we are using same blob ID for all tests, clear cache which stores blobs that are not found in router.
      router.getNotFoundCache().invalidateAll();

      if (router != null) {
        router.close();
      }
    }
  }
Test TTLUpdate first hits Not_FOUND. Then run ReplicateBlob and Retry. It is successful.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/NonBlockingRouterTest.java