// Create a channel with a ValidatingChannelListener and join the
// client to the channel.
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() {
ChannelListener listener =
new ValidatingChannelListener();
dataService.setBinding(listenerName, listener);
ClientSession session =
(ClientSession) dataService.getBinding(user);
Channel channel =
channelService.createChannel(
channelName, listener, Delivery.RELIABLE);
channel.join(session);
}
}, taskOwner);
// Wait for the client to join, and then send a channel message.
client.assertJoinedChannel(channelName);
client.sendChannelMessage(channelName, 0);
// Validate that the session passed to the handleChannelMessage
// method was a wrapped ClientSession.
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() {
ValidatingChannelListener listener = (ValidatingChannelListener)
dataService.getBinding(listenerName);
ClientSession session =
(ClientSession) dataService.getBinding(user);
listener.validateSession(session);
System.err.println("sessions are equal");
}
}, taskOwner);
}