void compareWithFuture() throws InterruptedException, TimeoutException {
    Long futureResult = null;
    Exception futureException = null;
    try {
      futureResult = future.get(1, TimeUnit.MILLISECONDS);
    } catch (ExecutionException e) {
      futureException = e;
    }

    if (!callbackReceived.await(1, TimeUnit.MILLISECONDS)) {
      throw new IllegalStateException("Callback has not been invoked even though future.get() has returned");
    } else {
      if (futureException == null) {
        assertEquals("Future and callback results don't match", futureResult, result);
        assertNull("There should have been no exception in the callback", exception);
      } else {
        assertEquals("Future and callback exceptions don't match", Utils.getRootCause(exception).getMessage(),
            Utils.getRootCause(futureException).getMessage());
      }
    }
  }
Compares the data obtained from the callback with the data obtained from future.
@throws InterruptedException
@throws TimeoutException
ambry-rest/src/test/java/com/github/ambry/rest/NettyResponseChannelTest.java