@Test
public void testRegisterOpenSession() throws Exception {
IMocksControl control = EasyMock.createControl();
NioSession session = control.createMock(NioSession.class);
EasyMock.makeThreadSafe(session, true);
// next reactor��index=2
Reactor nextReactor = this.selectorManager.getReactorByIndex(2);
session.onEvent(EventType.ENABLE_READ, nextReactor.getSelector());
EasyMock.expectLastCall();
EasyMock.expect(session.isClosed()).andReturn(false).times(2);
EasyMock.expect(session.getAttribute(SelectorManager.REACTOR_ATTRIBUTE)).andReturn(null);
EasyMock.expect(session.setAttributeIfAbsent(SelectorManager.REACTOR_ATTRIBUTE, nextReactor)).andReturn(null);
control.replay();
this.selectorManager.registerSession(session, EventType.ENABLE_READ);
Thread.sleep(Reactor.DEFAULT_WAIT * 3);
control.verify();