/** Disconnect a consumer and provider component and clean them up. */ public static void closeSession(Consumer consumer, Provider provider) { /* Make sure there's nothing left in the dispatch queue. */ consumer.testReactor().dispatch(0); provider.testReactor().dispatch(0); consumer.close(); provider.close(); }
provider.testReactor().accept(sessionOpts, provider); provider.testReactor().dispatch(2); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.LOGIN_MSG, event.type()); loginMsgEvent = (RDMLoginMsgEvent)event.reactorEvent(); provider.testReactor().accept(sessionOpts, provider); provider.testReactor().dispatch(2); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent();
provider.testReactor().accept(sessionOpts, provider); provider.testReactor().dispatch(2); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.LOGIN_MSG, event.type()); loginMsgEvent = (RDMLoginMsgEvent)event.reactorEvent();
provider.testReactor().accept(opts, provider); provider.testReactor().dispatch(2); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_UP, channelEvent.eventType()); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.CHANNEL_EVENT, event.type()); channelEvent = (ReactorChannelEvent)event.reactorEvent(); assertEquals(ReactorChannelEventTypes.CHANNEL_READY, channelEvent.eventType()); provider.testReactor().dispatch(0); provider.testReactor().dispatch(1); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.LOGIN_MSG, event.type()); loginMsgEvent = (RDMLoginMsgEvent)event.reactorEvent(); provider.testReactor().dispatch(0); provider.testReactor().dispatch(1); event = provider.testReactor().pollEvent(); assertEquals(TestReactorEventTypes.DIRECTORY_MSG, event.type()); directoryMsgEvent = (RDMDirectoryMsgEvent)event.reactorEvent();