@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testConnectTwoParties() { networks = createNetworks(2); }
protected Map<Integer, CloseableNetwork> createNetworks(int numParties) { List<NetworkConfiguration> confs = getNetConfs(numParties); return createNetworks(confs); }
@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testConnectOneParty() { networks = createNetworks(1); }
@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testConnectMultipleParties() { networks = createNetworks(7); }
@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testSelfSendThreeParties() { networks = createNetworks(3); networks.keySet().stream().forEach(i -> networks.get(i).send(i, new byte[] { 0x01 })); networks.keySet().stream().forEach(i -> networks.get(i).receive(i)); }
@Test(expected = IllegalArgumentException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testReceiveFromNegativePartyId() { networks = createNetworks(1); networks.get(1).receive(-1); }
@Test(expected = IllegalArgumentException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testSendToTooLargePartyId() { networks = createNetworks(1); networks.get(1).send(2, new byte[] { 0x01 }); }
@Test(expected = IllegalArgumentException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testSendToNegativePartyId() { networks = createNetworks(1); networks.get(1).send(-1, new byte[] { 0x01 }); }
@Test(expected = IllegalArgumentException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testReceiveFromTooLargePartyId() { networks = createNetworks(1); networks.get(1).receive(2); }
@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testClose() { networks = createNetworks(3); closeNetworks(networks); }
private void testMultiplePartiesReconnect(int numParties, int noOfRetries) { List<NetworkConfiguration> confs = getNetConfs(numParties); for (int i = 0; i < noOfRetries; i++) { networks = createNetworks(confs); closeNetworks(networks); } }
@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS, expected = RuntimeException.class) public void testSendAfterClose() { networks = createNetworks(3); closeNetworks(networks); networks.get(1).send(2, new byte[] {}); }
@Test(timeout = TWO_MINUTE_TIMEOUT_MILLIS, expected = RuntimeException.class) public void testReceiveAfterClose() { networks = createNetworks(3); closeNetworks(networks); networks.get(1).receive(2); }
Map<Integer, CloseableNetwork> networks = createNetworks(numParties); ExecutorService es = Executors.newFixedThreadPool(numParties); List<Future<?>> fs = new ArrayList<>(numParties);
networks = createNetworks(numParties); ExecutorService es = Executors.newFixedThreadPool(numParties); List<Future<?>> fs = new ArrayList<>(numParties);
Map<Integer, CloseableNetwork> networks = createNetworks(numParties); ExecutorService es = Executors.newFixedThreadPool(numParties); List<Future<?>> fs = new ArrayList<>(numParties);