summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
Diffstat (limited to 'luni')
-rw-r--r--luni/src/test/java/libcore/java/net/OldSocketTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/java/net/OldSocketTest.java b/luni/src/test/java/libcore/java/net/OldSocketTest.java
index 80bee69..7973965 100644
--- a/luni/src/test/java/libcore/java/net/OldSocketTest.java
+++ b/luni/src/test/java/libcore/java/net/OldSocketTest.java
@@ -1251,6 +1251,12 @@ public class OldSocketTest extends OldSocketTestCase {
theSocket.connect(nonReachableAddress, 200);
theSocket.close();
fail("No interrupted exception when connecting to address nobody listening on with short timeout 200: ");
+ } catch (ConnectException ce) {
+ // some networks will quickly reset the TCP connection attempt to this fake IP
+ assertTrue(
+ "Wrong exception when connecting to address nobody listening on with short timeout 200: "
+ + ce.toString(),
+ (ce.getMessage() != null && ce.getMessage().contains("ECONNREFUSED")));
} catch (Exception e) {
assertTrue(
"Wrong exception when connecting to address nobody listening on with short timeout 200: "
@@ -1266,6 +1272,12 @@ public class OldSocketTest extends OldSocketTestCase {
theSocket.connect(nonReachableAddress, 40);
theSocket.close();
fail("No interrupted exception when connecting to address nobody listening on with short timeout 40: ");
+ } catch (ConnectException ce) {
+ // some networks will quickly reset the TCP connection attempt to this fake IP
+ assertTrue(
+ "Wrong exception when connecting to address nobody listening on with short timeout 40: "
+ + ce.toString(),
+ (ce.getMessage() != null && ce.getMessage().contains("ECONNREFUSED")));
} catch (Exception e) {
assertTrue(
"Wrong exception when connecting to address nobody listening on with short timeout 40: "