@SuppressWarnings("unchecked")
public void testRandomRegularAndOOBMulticasts() throws Exception {
DISCARD discard=new DISCARD();
discard.setLocalAddress(c1.getAddress());
discard.setDownDiscardRate(0.5);
ProtocolStack stack=c1.getProtocolStack();
stack.insertProtocol(discard, ProtocolStack.BELOW, NAKACK.class);
MyReceiver r1=new MyReceiver("C1"), r2=new MyReceiver("C2");
c1.setReceiver(r1);
c2.setReceiver(r2);
final int NUM_MSGS=20;
final int NUM_THREADS=10;
send(null, NUM_MSGS, NUM_THREADS, 0.5); // send on random channel (c1 or c2)
Collection<Integer> one=r1.getMsgs(), two=r2.getMsgs();
for(int i=0; i < 10; i++) {
if(one.size() == NUM_MSGS && two.size() == NUM_MSGS)
break;
log.info("one size " + one.size() + ", two size " + two.size());
Util.sleep(1000);
sendStableMessages(c1,c2);
}
log.info("one size " + one.size() + ", two size " + two.size());
stack.removeProtocol("DISCARD");
for(int i=0; i < 5; i++) {
if(one.size() == NUM_MSGS && two.size() == NUM_MSGS)
break;
sendStableMessages(c1,c2);