diff options
author | Elliott Hughes <enh@google.com> | 2014-11-11 17:01:58 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-11-11 17:01:58 -0800 |
commit | ca9037fc1f060c071d6711bbe31c9f9de63a0b89 (patch) | |
tree | 518438abb82a7464d291670725da0e12af4219f3 /support | |
parent | acac58bae79a73219f23f48d59fc2971fc81f3b1 (diff) | |
download | libcore-ca9037fc1f060c071d6711bbe31c9f9de63a0b89.zip libcore-ca9037fc1f060c071d6711bbe31c9f9de63a0b89.tar.gz libcore-ca9037fc1f060c071d6711bbe31c9f9de63a0b89.tar.bz2 |
Fix OldSocketTest#test_connectLjava_net_SocketAddressI.
Use the same address as StuckServer.
Bug: 18143878
Change-Id: I3759776ed3a9d46175c4b987fa0c47b27033441d
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/tests/net/StuckServer.java | 21 | ||||
-rw-r--r-- | support/src/test/java/tests/support/Support_Configuration.java | 10 |
2 files changed, 15 insertions, 16 deletions
diff --git a/support/src/test/java/tests/net/StuckServer.java b/support/src/test/java/tests/net/StuckServer.java index f7a3118..d6b038b 100644 --- a/support/src/test/java/tests/net/StuckServer.java +++ b/support/src/test/java/tests/net/StuckServer.java @@ -21,6 +21,7 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; +import java.net.UnknownHostException; import java.util.ArrayList; /** @@ -29,6 +30,19 @@ import java.util.ArrayList; public final class StuckServer { private static final boolean DEBUG = false; + // RFC 5737 implies this network -- "test net 1" -- will be unreachable. + // (There are two other networks to try if we have trouble with this one.) + // We've had trouble with 10.* in the past (because test labs running CTS often use + // net 10!) but hopefully this network will be better. + public static final InetAddress UNREACHABLE_ADDRESS; + static { + try { + UNREACHABLE_ADDRESS = InetAddress.getByAddress(new byte[] { (byte) 192, 0, 2, 0 }); + } catch (UnknownHostException ex) { + throw new AssertionError(ex); + } + } + private ServerSocket serverSocket; private InetSocketAddress address; private ArrayList<Socket> clients = new ArrayList<Socket>(); @@ -57,12 +71,7 @@ public final class StuckServer { } } else { // In general, though, you don't want to rely on listen(2) backlog. http://b/6971145. - // RFC 5737 implies this network will be unreachable. (There are two other networks - // to try if we have trouble with this one.) - // We've had trouble with 10.* in the past (because test labs running CTS often use - // net 10!) but hopefully this network will be better. - InetAddress testNet1 = InetAddress.getByAddress(new byte[] { (byte) 192, 0, 2, 0 }); - this.address = new InetSocketAddress(testNet1, 80); + this.address = new InetSocketAddress(UNREACHABLE_ADDRESS, 80); } } diff --git a/support/src/test/java/tests/support/Support_Configuration.java b/support/src/test/java/tests/support/Support_Configuration.java index 9cb617d..0658d54 100644 --- a/support/src/test/java/tests/support/Support_Configuration.java +++ b/support/src/test/java/tests/support/Support_Configuration.java @@ -75,11 +75,6 @@ public class Support_Configuration { public static String IPv6GlobalAddressJcl4 = "2001:4860:8004::67"; // ipv6.google.com - // ip address that resolves to a host that is not present on the local - // network - // this allows us to check the timeouts for connect - public static String ResolvedNotExistingHost = "9.26.194.72"; - // BEGIN android-changed /** * An address that resolves to more than one IP address so that the @@ -279,11 +274,6 @@ public class Support_Configuration { URLConnectionDate = Long.parseLong(value); } - value = props.get("ResolvedNotExistingHost"); - if (value != null) { - ResolvedNotExistingHost = value; - } - value = props.get("InetAlias1"); if (value != null) { InetAlias1 = value; |