AnonymizedOriginTracer extends MessageInterceptorAdapter { public boolean log(Message message) { InetSocketAddress address = message.getSourceContext().getPeerAddress(); synchronized (currentTests) { if (currentTests.get(address) != null) { return false; } currentTests.put(address, scheme); } String id = getAnonymizedOrigin(address.getAddress()); if (id != null) { if (scheme == null) { LOGGER.trace("{}:{}", id, address.getPort()); } else { LOGGER.trace("{}: } return true; } return false; } AnonymizedOriginTracer(String scheme);  AnonymizedOriginTracer(String scheme, long filterTimeout); @Override void receiveRequest(Request request); @Override void receiveEmptyMessage(EmptyMessage message); boolean log(Message message); static String getAnonymizedOrigin(InetAddress address);  }
@Test public void testFilterLogging() throws InterruptedException { assertTrue(log(address1)); assertTrue(log(address2)); assertFalse(log(address1_2)); assertTrue(log(address3)); time.addTestTimeShift(FILTER_TIMEOUT_IN_SECONDS + 1, TimeUnit.SECONDS); assertTrue(log(address1)); }