use of io.vertx.core.net.impl.transport.Transport in project vert.x by eclipse.
the class VertxStartFailureTest method failStart.
private Throwable failStart(VertxOptions options) throws Exception {
List<EventLoopGroup> loops = new ArrayList<>();
CountDownLatch latch = new CountDownLatch(1);
Transport transport = new Transport() {
@Override
public EventLoopGroup eventLoopGroup(int type, int nThreads, ThreadFactory threadFactory, int ioRatio) {
EventLoopGroup eventLoop = super.eventLoopGroup(type, nThreads, threadFactory, ioRatio);
loops.add(eventLoop);
return eventLoop;
}
};
AtomicReference<AsyncResult<Vertx>> resultRef = new AtomicReference<>();
new VertxBuilder(options).init().transport(transport).clusteredVertx(ar -> {
resultRef.set(ar);
latch.countDown();
});
awaitLatch(latch);
assertFalse(resultRef.get() == null);
assertTrue(resultRef.get().failed());
loops.forEach(loop -> {
waitUntil(loop::isShutdown);
});
return resultRef.get().cause();
}
use of io.vertx.core.net.impl.transport.Transport in project vert.x by eclipse.
the class VertxFactoryTest method testFactoryTransportOverridesDefault.
@Test
public void testFactoryTransportOverridesDefault() {
VertxBuilder factory = new VertxBuilder();
// JDK transport
Transport override = new Transport() {
};
factory.transport(override);
factory.init();
Vertx vertx = factory.vertx();
assertSame(override, ((VertxInternal) vertx).transport());
}
Aggregations