}
}
public void testAddResponses() throws Exception {
Responses rsps=new Responses(10, true);
System.out.println("rsps = " + rsps);
assert !rsps.isDone();
for(int i=0; i < 5; i++)
rsps.addResponse(new PingData(addrs[i], true, names[i], phys_addrs[i]), false);
System.out.println("rsps = " + rsps);
assert !rsps.isDone();
assert !rsps.waitFor(500);
for(int i=0; i < 5; i++)
assert rsps.containsResponseFrom(addrs[i]);
assert !rsps.containsResponseFrom(addrs[5]);
for(int i=0; i < 5; i++)
rsps.addResponse(new PingData(addrs[i], true, names[i], phys_addrs[i]), false);
System.out.println("rsps = " + rsps);
assert !rsps.isDone() && rsps.size() == 5;
for(int i=0; i < 5; i++)
rsps.addResponse(new PingData(addrs[i], true, names[i], phys_addrs[i]), true);
System.out.println("rsps = " + rsps);
assert !rsps.isDone() && rsps.size() == 5;
for(int i=5; i < 10; i++)
rsps.addResponse(new PingData(addrs[i], true, names[i], phys_addrs[i]), false);
System.out.println("rsps = " + rsps);
assert rsps.isDone() && rsps.size() == 10;
assert rsps.waitFor(60000);
}