use of io.vertx.core.http.impl.Http2ServerConnection in project vert.x by eclipse.
the class Http2Test method testDiscardConnectionWhenChannelBecomesInactive.
@Test
public void testDiscardConnectionWhenChannelBecomesInactive() throws Exception {
AtomicInteger count = new AtomicInteger();
server.requestHandler(req -> {
if (count.getAndIncrement() == 0) {
Http2ServerConnection a = (Http2ServerConnection) req.connection();
DuplexChannel channel = (DuplexChannel) a.channel();
channel.shutdown();
} else {
req.response().end();
}
});
startServer(testAddress);
AtomicInteger closed = new AtomicInteger();
client.connectionHandler(conn -> conn.closeHandler(v -> closed.incrementAndGet()));
client.request(requestOptions).onComplete(onSuccess(req -> {
req.send(onFailure(err -> {
}));
}));
AsyncTestBase.assertWaitUntil(() -> closed.get() == 1);
client.request(requestOptions).compose(HttpClientRequest::send).onComplete(onSuccess(resp -> {
testComplete();
}));
await();
}
Aggregations