@Test
public void testServer() throws Exception {
Filter socketFilter = new ThreadFilter(Filter.Result.NEUTRAL, Filter.Result.DENY);
Filter serverFilter = new ThreadFilter(Filter.Result.DENY, Filter.Result.NEUTRAL);
CompositeFilter socketFilters = CompositeFilter.createFilters(new Filter[]{socketFilter});
SocketAppender appender = SocketAppender.createAppender("localhost", PORT, "tcp", "-1",
"Test", null, null, null, socketFilters);
appender.start();
CompositeFilter serverFilters = CompositeFilter.createFilters(new Filter[]{serverFilter});
ListAppender listApp = new ListAppender("Events", serverFilters, null, false, false);
appender.start();
PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null);
ConsoleAppender console = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "true");
Logger serverLogger = ctx.getLogger(SocketServer.class.getName());
serverLogger.addAppender(console);
serverLogger.setAdditive(false);