@Override
  public void onSuccess(RestResponse restResponse)
  {
    Response<MultiplexedResponseContent> response;
    try
    {
      response = _decoder.decodeResponse(restResponse);
    }
    catch (RestLiDecodingException e)
    {
      onError(e);
      return;
    }
    // individual callbacks are notified first
    notifyIndividualCallbacks(response);
    // aggregated callback is guaranteed to be called after all individual callbacks
    notifyAggregatedCallback(response);
  }
@Test
  public void testMixed() throws Exception
  {
    FutureCallback<RestResponse> callback1 = new FutureCallback<>();
    FutureCallback<RestResponse> callback2 = new FutureCallback<>();

    ImmutableMap<Integer, Callback<RestResponse>> individualCallbacks = ImmutableMap.<Integer, Callback<RestResponse>>of(ID1, callback1, ID2, callback2);
    FutureCallback<MultiplexedResponse> aggregatedCallback = new FutureCallback<>();

    TestRecord entity1 = fakeEntity(ID1);
    IndividualResponse ir1 = fakeIndividualResponse(entity1);
    IndividualResponse ir2 = fakeIndividualErrorResponse();

    MultiplexedResponseContent responseContent = new MultiplexedResponseContent()
        .setResponses(new IndividualResponseMap(ImmutableMap.of(Integer.toString(ID1), ir1, Integer.toString(ID2), ir2)));

    MultiplexedCallback multiplexedCallback = new MultiplexedCallback(individualCallbacks, aggregatedCallback);
    multiplexedCallback.onSuccess(fakeRestResponse(responseContent));

    assertRestResponseEquals(callback1.get(), fakeRestResponse(entity1));

    RestException actualError = (RestException) getError(callback2);
    assertRestResponseEquals(actualError.getResponse(), fakeRestErrorResponse());

    MultiplexedResponse multiplexedResponse = aggregatedCallback.get();
    Assert.assertEquals(multiplexedResponse.getStatus(), HttpStatus.S_200_OK.getCode());
    Assert.assertEquals(multiplexedResponse.getHeaders(), HEADERS);
  }