use of com.linkedin.r2.message.stream.entitystream.Observer in project rest.li by linkedin.
the class TestRestLiServer method testUnstructuredDataGetWithBody.
@Test
public void testUnstructuredDataGetWithBody() throws Exception {
EntityStream streams = EntityStreams.newEntityStream(new ByteStringWriter(ByteString.copy(new byte[] { 1, 2, 3, 4 })));
Observer observer = new TestObserver();
streams.addObserver(observer);
final StreamRequest streamRequest = new StreamRequestBuilder(new URI("/reactiveGreetingCollectionUnstructuredData/hello")).setHeader(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, AllProtocolVersions.BASELINE_PROTOCOL_VERSION.toString()).build(streams);
final Callback<StreamResponse> callback = new Callback<StreamResponse>() {
@Override
public void onSuccess(StreamResponse streamResponse) {
}
@Override
public void onError(Throwable e) {
}
};
_server.handleRequest(streamRequest, new RequestContext(), callback);
assertTrue(((TestObserver) observer).isDone());
}
Aggregations