@Test
public void testSubscriptionDeniedRemovesListener() throws Exception
{
final AtomicBoolean subscriptionAllowed = new AtomicBoolean(false);
evaluateScript("var subscriptionAllowed = false;");
bayeuxServer.setSecurityPolicy(new DefaultSecurityPolicy()
{
@Override
public boolean canSubscribe(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
{
return subscriptionAllowed.get();