protected Map<Integer, CloseableNetwork> createNetworks(int numParties) { List<NetworkConfiguration> confs = getNetConfs(numParties); return createNetworks(confs); }
@Test(expected = RuntimeException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testNegativeTimeout() { List<NetworkConfiguration> conf = getNetConfs(2); newCloseableNetwork(conf.get(1), Duration.ofMillis(-10)); }
@Test(expected = RuntimeException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testConnectTimeout() { List<NetworkConfiguration> confs = getNetConfs(2); // This should time out waiting for a connection to a party that is not listening newCloseableNetwork(confs.get(0), Duration.ofMillis(10)); }
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(expected = RuntimeException.class, timeout = TWO_MINUTE_TIMEOUT_MILLIS) public void testFailToBind() throws Throwable { ServerSocket socket = null; try { List<NetworkConfiguration> confs = getNetConfs(2); socket = ServerSocketFactory.getDefault().createServerSocket(confs.get(1).getMe().getPort()); newCloseableNetwork(confs.get(1)); } finally { socket.close(); } }