public GroupChannel createChannel() { channel = new GroupChannel(); ((ReceiverBase)channel.getChannelReceiver()).setAutoBind(100); interceptor = new NonBlockingCoordinator() { @Override public void fireInterceptorEvent(InterceptorEvent event) { status = event.getEventTypeDesc(); int type = event.getEventType(); boolean display = VIEW_EVENTS[type]; if ( display ) parent.printScreen(); try { Thread.sleep(SLEEP_TIME); }catch ( Exception x){ // Ignore } } }; channel.addInterceptor(interceptor); channel.addInterceptor(new TcpFailureDetector()); channel.addInterceptor(new MessageDispatch15Interceptor()); return channel; }
@Before public void setUp() throws Exception { channel1 = new GroupChannel(); channel1.addInterceptor(new MessageDispatch15Interceptor()); channel2 = new GroupChannel(); channel2.addInterceptor(new MessageDispatch15Interceptor()); ThroughputInterceptor tint = new ThroughputInterceptor(); tint.setInterval(500); ThroughputInterceptor tint2 = new ThroughputInterceptor(); tint2.setInterval(500); //channel1.addInterceptor(tint); channel2.addInterceptor(tint2); listener1 = new Listener(); ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver(); ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver(); rb1.setUdpPort(50000); rb2.setUdpPort(50000); channel2.addChannelListener(listener1); TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2}); channel1.start(Channel.DEFAULT); channel2.start(Channel.DEFAULT); }
@Before public void setUp() throws Exception { channel1 = new GroupChannel(); channel1.addInterceptor(new MessageDispatch15Interceptor()); channel2 = new GroupChannel(); channel2.addInterceptor(new MessageDispatch15Interceptor()); ThroughputInterceptor tint = new ThroughputInterceptor(); tint.setInterval(500); ThroughputInterceptor tint2 = new ThroughputInterceptor(); tint2.setInterval(500); //channel1.addInterceptor(tint); channel2.addInterceptor(tint2); listener1 = new Listener(); ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver(); ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver(); rb1.setUdpPort(50000); rb2.setUdpPort(50000); channel2.addChannelListener(listener1); channel1.start(Channel.DEFAULT); channel2.start(Channel.DEFAULT); }
@Test public void testUdpReceiverStart() throws Exception { ReceiverBase rb = (ReceiverBase)channel.getChannelReceiver(); rb.setUdpPort(udpPort); channel.start(Channel.DEFAULT); Thread.sleep(1000); channel.stop(Channel.DEFAULT); }
@Test public void testScrap() throws Exception { System.out.println(channel.getChannelReceiver().getClass()); ((ReceiverBase)channel.getChannelReceiver()).setMaxThreads(1); }