.protocol(dummyProtocol);
CountDownLatch latch = new CountDownLatch(1);
AtomicLong counter = new AtomicLong(1l);
Session gameRoomSession = new TestGameRoom(sessionBuilder, counter,
latch);
GameRoom gameRoom = (GameRoom) gameRoomSession;
PlayerSession playerSession = gameRoom.createPlayerSession(null);
gameRoom.connectSession(playerSession);
playerSession.addHandler(new SessionHandlerLatchCounter(playerSession,
counter, latch));
// start test
gameRoom.disconnectSession(playerSession);
JetlangEventDispatcher gameDispatcher = (JetlangEventDispatcher) gameRoomSession
.getEventDispatcher();
assertNoListeners(gameDispatcher);
Event event = Events.event(null, Events.SESSION_MESSAGE);
playerSession.onEvent(event);
assertFalse(latch.await(500, TimeUnit.MILLISECONDS));
// Connect to another game room
sessionBuilder.gameRoomName("Zombie_ROOM_2");
Session gameRoomSession2 = new TestGameRoom(sessionBuilder, counter,
latch);
GameRoom gameRoom2 = (GameRoom) gameRoomSession2;
gameRoom2.connectSession(playerSession);
playerSession.addHandler(new SessionHandlerLatchCounter(playerSession,
counter, latch));
playerSession.onEvent(event);
assertTrue(latch.await(500, TimeUnit.MILLISECONDS));
}