byte[] block = new byte[1024 * 256];
for (int x = 0; x < block.length; x++) {
block[x] = (byte) x;
}
PartiallyReceivedBlock prb1 = new PartiallyReceivedBlock(256, 1024, block);
final BlockTransmitter bt = new BlockTransmitter(usm1, p2, 0, prb1);
(new Thread() {
public void run() {
try {
bt.send();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}).start();
PartiallyReceivedBlock prb2 = new PartiallyReceivedBlock(256, 1024);
final BlockReceiver br = new BlockReceiver(usm2, p1, 0, prb2);
final BlockTransmitter bt2 = new BlockTransmitter(usm2, p3, 0, prb2);
PartiallyReceivedBlock prb3 = new PartiallyReceivedBlock(256, 1024);
final BlockReceiver br2 = new BlockReceiver(usm3, p2, 0, prb3);
(new Thread() {
public void run() {
try {
br.receive();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}).start();
(new Thread() {
public void run() {
try {
bt2.send();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}).start();