listener.reset();
evaluateScript("var publishLatch = new Latch(1);");
Latch publishLatch = get("publishLatch");
evaluateScript("cometd.addListener('/meta/publish', publishLatch, 'countDown');");
evaluateScript("cometd.publish('/echo', 'test');");
Assert.assertTrue(publishLatch.await(5000));
Assert.assertTrue(messageLatch.await(5000));
Assert.assertEquals(1, listener.getOutgoingMessageCount()); // publish
Assert.assertEquals(2, listener.getIncomingMessageCount()); // publish, message
listener.reset();