public MythologicChannelSessionListener( ClientSession clientSession, ManagedReference<Channel> channel1) { super(clientSession); // Join the session to all channels. We obtain the channel // in two different ways, by reference and by name. ChannelManager channelMgr = AppContext.getChannelManager(); // We were passed a reference to the first channel. channel1.get().join(clientSession); // We look up the second channel by name. Channel channel2 = channelMgr.getChannel("a"); channel2.join(clientSession); }
@Before public void initializeContext() { // create the context MockSGS.init(); // update the behavior of the ChannelManager ChannelManager channelManager = EasyMock.createMock(ChannelManager.class); ((MockManagerLocator) InternalContext.getManagerLocator()).setChannelManager(channelManager); gameChannel = EasyMock.createNiceMock(Channel.class); EasyMock.expect( channelManager.createChannel( SnowmanGameImpl.CHANPREFIX + gameName, null, Delivery.RELIABLE)) .andStubReturn(gameChannel); EasyMock.replay(channelManager); EasyMock.replay(gameChannel); }