use of org.asynchttpclient.AsyncCompletionHandlerBase in project async-http-client by AsyncHttpClient.
the class AsyncHttpSingleTest method testAbort.
@Test(groups = "standalone")
public void testAbort() throws Exception {
final TestSubscriber<Response> subscriber = new TestSubscriber<>();
try (AsyncHttpClient client = asyncHttpClient()) {
final Single<Response> underTest = AsyncHttpSingle.create(client.prepareGet("http://gatling.io"), () -> new AsyncCompletionHandlerBase() {
@Override
public State onStatusReceived(HttpResponseStatus status) {
return State.ABORT;
}
});
underTest.subscribe(subscriber);
subscriber.awaitTerminalEvent();
}
subscriber.assertTerminalEvent();
subscriber.assertNoErrors();
subscriber.assertCompleted();
subscriber.assertValue(null);
}
Aggregations