public void testConnectToServerAcceptingAllHosts() throws Exception { Map<NetworkInterface, InetAddress> map = NetworkAddressTestBase.getAddressForEachNetworkInterface(); Set<Entry<NetworkInterface, InetAddress>> set = map.entrySet(); for (Entry<NetworkInterface, InetAddress> entry : set) { String host = entry.getValue().getHostAddress(); testConnection("0.0.0.0", host, true); } }
public void testConnectorToServerAcceptingAListOfHosts() throws Exception { Map<NetworkInterface, InetAddress> map = NetworkAddressTestBase.getAddressForEachNetworkInterface(); if (map.size() <= 1) { System.err.println("There must be at least 2 network interfaces: test will not be executed"); return; } Set<Entry<NetworkInterface, InetAddress>> set = map.entrySet(); Iterator<Entry<NetworkInterface, InetAddress>> iterator = set.iterator(); Entry<NetworkInterface, InetAddress> entry1 = iterator.next(); Entry<NetworkInterface, InetAddress> entry2 = iterator.next(); String listOfHosts = entry1.getValue().getHostAddress() + ", " + entry2.getValue().getHostAddress(); testConnection(listOfHosts, entry1.getValue().getHostAddress(), true); testConnection(listOfHosts, entry2.getValue().getHostAddress(), true); }
public void testConnectToServerWithSameHost() throws Exception { Map<NetworkInterface, InetAddress> map = NetworkAddressTestBase.getAddressForEachNetworkInterface(); if (map.size() > 0) { Set<Entry<NetworkInterface, InetAddress>> set = map.entrySet(); Iterator<Entry<NetworkInterface, InetAddress>> iterator = set.iterator(); InetAddress address = iterator.next().getValue(); String host = address.getHostAddress(); testConnection(host, host, true); } }
public void testConnectToServerAcceptingOnlyAnotherHost() throws Exception { Map<NetworkInterface, InetAddress> map = NetworkAddressTestBase.getAddressForEachNetworkInterface(); if (map.size() <= 1) { System.err.println("There must be at least 1 network interfaces: test will not be executed"); return; } Set<Entry<NetworkInterface, InetAddress>> set = map.entrySet(); Iterator<Entry<NetworkInterface, InetAddress>> iterator = set.iterator(); Entry<NetworkInterface, InetAddress> acceptorEntry = iterator.next(); Entry<NetworkInterface, InetAddress> connectorEntry = iterator.next(); testConnection( acceptorEntry.getValue().getHostName(), connectorEntry.getValue().getHostAddress(), false); }