FutureChannelCreator fcc = recv1.connectionBean().reservation().create(0, 50);
fcc.awaitUninterruptibly();
ChannelCreator cc = fcc.channelCreator();
for (int j = 0; j < 50; j++) {
FutureResponse fr = sender.pingRPC().pingTCP(recv1.peerAddress(), cc,
new DefaultConnectionConfiguration());
list.add(fr);
}
for (FutureResponse fr2 : list) {
fr2.awaitUninterruptibly();
if (!fr2.isSuccess())
System.err.println("fail " + fr2.failedReason());
Assert.assertEquals(true, fr2.isSuccess());
}
list.clear();
cc.shutdown().await();
}
System.out.println("TCP time: " + (System.currentTimeMillis() - start));
for (FutureResponse fr2 : list) {
fr2.awaitUninterruptibly();
Assert.assertEquals(true, fr2.isSuccess());
}
//
start = System.currentTimeMillis();
list = new ArrayList<FutureResponse>(50);
for (int i = 0; i < 20; i++) {
FutureChannelCreator fcc = recv1.connectionBean().reservation().create(50, 0);
fcc.awaitUninterruptibly();
ChannelCreator cc = fcc.channelCreator();
for (int j = 0; j < 50; j++) {
FutureResponse fr = sender.pingRPC().pingUDP(recv1.peerAddress(), cc,
new DefaultConnectionConfiguration());
list.add(fr);
}
int ii = 0;
for (FutureResponse fr2 : list) {
System.err.println("waiting for " + (ii++) + fr2.request());