.createStrictControl(IoAcceptorConfig.class);
IoAcceptorConfig config = (IoAcceptorConfig) configControl.getMock();
MockControl chainControl = MockControl
.createStrictControl(IoFilterChain.class);
IoFilterChain chain = (IoFilterChain) chainControl.getMock();
session.setFilterChain(chain);
MockControl listenerControl = MockControl
.createStrictControl(IoServiceListener.class);
IoServiceListener listener = (IoServiceListener) listenerControl
.getMock();
// Activate a service and create a session.
listener.serviceActivated(acceptor, ADDRESS, null, config);
listener.sessionCreated(session);
chain.fireSessionCreated(session);
chain.fireSessionOpened(session);
listenerControl.replay();
chainControl.replay();
support.add(listener);
support.fireServiceActivated(acceptor, ADDRESS, null, config);
support.fireSessionCreated(session);
listenerControl.verify();
chainControl.verify();
// Deactivate a service and make sure the session is closed & destroyed.
listenerControl.reset();
chainControl.reset();
listener.serviceDeactivated(acceptor, ADDRESS, null, config);
configControl.expectAndReturn(config.isDisconnectOnUnbind(), true);
listener.sessionDestroyed(session);
chain.fireSessionClosed(session);
listenerControl.replay();
configControl.replay();
chainControl.replay();