use of com.linkedin.restli.examples.greetings.client.GreetingsCallbackBuilders in project rest.li by linkedin.
the class TestMultiplexerIntegration method singleCall.
@Test
public void singleCall() throws Exception {
GetRequest<Greeting> request = new GreetingsCallbackBuilders().get().id(1L).build();
FutureCallback<Response<Greeting>> muxCallback = new FutureCallback<Response<Greeting>>();
FutureCallback<Response<Greeting>> directCallback = new FutureCallback<Response<Greeting>>();
FutureCallback<MultiplexedResponse> aggregatedCallback = new FutureCallback<MultiplexedResponse>();
MultiplexedRequest multiplexedRequest = MultiplexedRequestBuilder.createParallelRequest().addRequest(request, muxCallback).build();
getClient().sendRequest(multiplexedRequest, aggregatedCallback);
getClient().sendRequest(request, directCallback);
assertEqualResponses(muxCallback, directCallback);
MultiplexedResponse multiplexedResponse = aggregatedCallback.get();
Assert.assertEquals(multiplexedResponse.getStatus(), HttpStatus.S_200_OK.getCode());
Assert.assertFalse(multiplexedResponse.getHeaders().isEmpty());
}
Aggregations