use of io.vertx.test.fakemetrics.FakeHttpClientMetrics in project vert.x by eclipse-vertx.
the class HttpMetricsTestBase method testClientConnectionClosed.
@Test
public void testClientConnectionClosed() throws Exception {
server.requestHandler(req -> {
req.response().setChunked(true).write(Buffer.buffer("some-data"));
});
startServer();
client = vertx.createHttpClient(createBaseClientOptions().setIdleTimeout(2));
FakeHttpClientMetrics metrics = FakeMetricsBase.getMetrics(client);
client.request(requestOptions).onComplete(onSuccess(req -> {
req.send(onSuccess(resp -> {
HttpClientMetric metric = metrics.getMetric(resp.request());
assertNotNull(metric);
assertFalse(metric.failed.get());
resp.exceptionHandler(err -> {
assertNull(metrics.getMetric(resp.request()));
assertTrue(metric.failed.get());
testComplete();
});
}));
}));
await();
}
use of io.vertx.test.fakemetrics.FakeHttpClientMetrics in project vert.x by eclipse-vertx.
the class HttpMetricsTestBase method testResetImmediately.
@Test
public void testResetImmediately() {
FakeHttpClientMetrics metrics = FakeMetricsBase.getMetrics(client);
server.requestHandler(req -> {
}).listen(testAddress, onSuccess(v -> {
client.request(HttpMethod.GET, 8080, "localhost", "/somepath", onSuccess(request -> {
assertNull(metrics.getMetric(request));
request.reset(0);
vertx.setTimer(10, id -> {
testComplete();
});
}));
}));
await();
}
Aggregations