public void socketTest(final MockSocket.ChannelProvider provider, final int socketRange, final int relayRange) throws IOException, InterruptedException {
final int num = 2;
final int packets = 10;
final int tests = 1;
final List<MockSocket> cs = new ArrayList<MockSocket>();
final List<RelayChannel> rc = new ArrayList<RelayChannel>();
for (int i = 0, j = 0, l = 0; i < num; i++, j++, l++) {
for (int t = 0; t < num; t++) {
try {
final MockSocket s = new MockSocket(localIP, socketRange + j, provider);
cs.add(s);
break;
} catch (BindException e) {
j++;
}
}
if (i % 2 == 0) {
for (int t = 0; t < num; t++) {
try {
final RelayChannel c = new RelayChannel(localIP, relayRange + l);
rc.add(c);
break;
} catch (BindException e) {
l++;
}
}
}
}
long tTime = 0;
long min = 1000;
long max = 0;
final AtomicInteger fSent = new AtomicInteger(0);
for (int h = 0; h < tests; h++) {
final List<Future> futures = new ArrayList<Future>();
public static boolean socketTest(final MockSocket.ChannelProvider provider, final SocketAddress sa, final SocketAddress sb) throws IOException, InterruptedException {
final int num = 2;
int packets = 25;
int tests = 100;
final List<MockSocket> cs = new ArrayList<MockSocket>();
for (int i = 0, j = 0, l = 0; i < num; i++, j++, l++) {
for (int t = 0; t < 50; t++) {
try {
final MockSocket s = new MockSocket(localIP, 20000 + j, provider);
cs.add(s);
break;
} catch (BindException e) {
j++;
}
}
}
long tTime = 0;
long min = 1000;
long max = 0;
boolean finished = true;
for (int h = 0; h < tests && finished; h++) {
final long start = System.currentTimeMillis();
for (int ii = 0; ii < packets; ii++)
for (int i = 0; i < num; i++) {
final MockSocket a = cs.get(i);
final MockSocket b = i % 2 == 0 ? cs.get(i + 1) : cs.get(i - 1);