use of io.vertx.test.netty.TestLoggerFactory in project vert.x by eclipse.
the class NetTest method testLogging.
private TestLoggerFactory testLogging() throws Exception {
InternalLoggerFactory prev = InternalLoggerFactory.getDefaultFactory();
TestLoggerFactory factory = new TestLoggerFactory();
InternalLoggerFactory.setDefaultFactory(factory);
try {
server.connectHandler(so -> {
so.write("fizzbuzz").end();
});
server.listen(1234, "localhost", onSuccess(v1 -> {
client.connect(1234, "localhost", onSuccess(so -> {
so.closeHandler(v2 -> testComplete());
}));
}));
await();
} finally {
InternalLoggerFactory.setDefaultFactory(prev);
}
return factory;
}
use of io.vertx.test.netty.TestLoggerFactory in project vert.x by eclipse.
the class DatagramTest method testSendLogging.
@Test
public void testSendLogging() throws Exception {
TestLoggerFactory factory = testLogging(new DatagramSocketOptions().setLogActivity(true), new DatagramSocketOptions());
assertTrue(factory.hasName("io.netty.handler.logging.LoggingHandler"));
}
use of io.vertx.test.netty.TestLoggerFactory in project vert.x by eclipse.
the class NetTest method testClientLogging.
@Test
public void testClientLogging() throws Exception {
client.close();
client = vertx.createNetClient(new NetClientOptions().setLogActivity(true));
TestLoggerFactory factory = testLogging();
assertTrue(factory.hasName("io.netty.handler.logging.LoggingHandler"));
}
use of io.vertx.test.netty.TestLoggerFactory in project vert.x by eclipse.
the class TestUtils method testLogging.
public static TestLoggerFactory testLogging(Runnable runnable) {
InternalLoggerFactory prev = InternalLoggerFactory.getDefaultFactory();
TestLoggerFactory factory = new TestLoggerFactory();
InternalLoggerFactory.setDefaultFactory(factory);
try {
runnable.run();
} finally {
InternalLoggerFactory.setDefaultFactory(prev);
}
return factory;
}
use of io.vertx.test.netty.TestLoggerFactory in project vert.x by eclipse.
the class DatagramTest method testNoLogging.
@Test
public void testNoLogging() throws Exception {
TestLoggerFactory factory = testLogging(new DatagramSocketOptions(), new DatagramSocketOptions());
assertFalse(factory.hasName("io.netty.handler.logging.LoggingHandler"));
}
Aggregations