use of io.vertx.test.core.Repeat in project vert.x by eclipse.
the class VertxTest method testWorkerExecutorConcurrentCloseWithVertx.
@Repeat(times = 100)
@Test
public void testWorkerExecutorConcurrentCloseWithVertx() throws InterruptedException {
Vertx vertx = Vertx.vertx();
try {
CountDownLatch latch = new CountDownLatch(1);
WorkerExecutor workerExecutor = vertx.createSharedWorkerExecutor("test");
vertx.runOnContext(v -> {
latch.countDown();
workerExecutor.close();
});
latch.await();
} finally {
vertx.close();
}
}
use of io.vertx.test.core.Repeat in project vert.x by eclipse.
the class Http1xTest method testCloseServerConnectionWithPendingMessages.
@Test
@Repeat(times = 10)
public void testCloseServerConnectionWithPendingMessages() throws Exception {
int n = 5;
server.requestHandler(req -> {
vertx.setTimer(100, id -> {
req.response().close();
});
});
startServer(testAddress);
client.close();
client = vertx.createHttpClient(createBaseClientOptions().setMaxPoolSize(n).setPipelining(true));
AtomicBoolean completed = new AtomicBoolean();
client.connectionHandler(conn -> {
conn.closeHandler(v -> {
if (completed.compareAndSet(false, true)) {
testComplete();
}
});
});
for (int i = 0; i < n * 2; i++) {
client.request(requestOptions).compose(HttpClientRequest::send).onComplete(onFailure(resp -> {
}));
}
await();
}
Aggregations