*/
mockHandler1.replay();
mockHandler2.replay();
mockHandler3.replay();
DemuxingIoHandler ioHandler = new DemuxingIoHandler();
/*
* First round. All messages should be handled by handler1
*/
ioHandler.addMessageHandler( C1.class, ( MessageHandler ) mockHandler1.getMock() );
ioHandler.messageReceived( session, msg[0] );
ioHandler.messageReceived( session, msg[1] );
ioHandler.messageReceived( session, msg[2] );
/*
* Second round. C1 messages should be handled by handler1. C2 and C3
* messages should be handled by handler2.
*/
ioHandler.addMessageHandler( C2.class, ( MessageHandler ) mockHandler2.getMock() );
ioHandler.messageReceived( session, msg[3] );
ioHandler.messageReceived( session, msg[4] );
ioHandler.messageReceived( session, msg[5] );
/*
* Third round. C1 messages should be handled by handler1, C2 by
* handler2 and C3 by handler3.
*/
ioHandler.addMessageHandler( C3.class, ( MessageHandler ) mockHandler3.getMock() );
ioHandler.messageReceived( session, msg[6] );
ioHandler.messageReceived( session, msg[7] );
ioHandler.messageReceived( session, msg[8] );
/*
* Verify.
*/
mockHandler1.verify();