public void testRegularAndOOBUnicasts2() throws Exception { DISCARD discard = new DISCARD(); ProtocolStack stack = a.getProtocolStack(); stack.insertProtocol( discard, ProtocolStack.BELOW, (Class<? extends Protocol>[]) Util.getUnicastProtocols()); Address dest = b.getAddress(); Message m1 = new Message(dest, 1); Message m2 = new Message(dest, 2).setFlag(Message.Flag.OOB); Message m3 = new Message(dest, 3).setFlag(Message.Flag.OOB); Message m4 = new Message(dest, 4); MyReceiver receiver = new MyReceiver("B"); b.setReceiver(receiver); a.send(m1); discard.setDropDownUnicasts(2); a.send(m2); // dropped a.send(m3); // dropped a.send(m4); Collection<Integer> list = receiver.getMsgs(); int count = 10; while (list.size() < 4 && --count > 0) { Util.sleep(500); // time for potential retransmission sendStableMessages(a, b); } System.out.println("list = " + list); assert list.size() == 4 : "list is " + list; assert list.contains(1) && list.contains(2) && list.contains(3) && list.contains(4); }
/** * Tests sending 1, 2 (OOB) and 3, where they are received in the order 1, 3, 2. Message 3 should * not get delivered until message 4 is received (http://jira.jboss.com/jira/browse/JGRP-780) */ public void testRegularAndOOBUnicasts() throws Exception { DISCARD discard = new DISCARD(); ProtocolStack stack = a.getProtocolStack(); stack.insertProtocol(discard, ProtocolStack.BELOW, UNICAST.class, UNICAST2.class); Address dest = b.getAddress(); Message m1 = new Message(dest, null, 1); Message m2 = new Message(dest, null, 2); m2.setFlag(Message.OOB); Message m3 = new Message(dest, null, 3); MyReceiver receiver = new MyReceiver("C2"); b.setReceiver(receiver); a.send(m1); discard.setDropDownUnicasts(1); a.send(m2); a.send(m3); Collection<Integer> list = receiver.getMsgs(); int count = 10; while (list.size() < 3 && --count > 0) { Util.sleep(500); // time for potential retransmission sendStableMessages(a, b); } assert list.size() == 3 : "list is " + list; assert list.contains(1) && list.contains(2) && list.contains(3); }
public void testRegularAndOOBUnicasts2() throws Exception { DISCARD discard = new DISCARD(); ProtocolStack stack = c1.getProtocolStack(); stack.insertProtocol(discard, ProtocolStack.BELOW, UNICAST.class, UNICAST2.class); Address dest = c2.getAddress(); Message m1 = new Message(dest, null, 1); Message m2 = new Message(dest, null, 2); m2.setFlag(Message.OOB); Message m3 = new Message(dest, null, 3); m3.setFlag(Message.OOB); Message m4 = new Message(dest, null, 4); MyReceiver receiver = new MyReceiver("C2"); c2.setReceiver(receiver); c1.send(m1); discard.setDropDownUnicasts(1); c1.send(m3); discard.setDropDownUnicasts(1); c1.send(m2); c1.send(m4); Util.sleep(1000); // sleep some time to receive all messages Collection<Integer> list = receiver.getMsgs(); int count = 10; while (list.size() < 4 && --count > 0) { Util.sleep(500); // time for potential retransmission sendStableMessages(c1, c2); } log.info("list = " + list); assert list.size() == 4 : "list is " + list; assert list.contains(1) && list.contains(2) && list.contains(3) && list.contains(4); }