summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-19 23:44:32 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-19 23:44:32 +0000
commit593d18f40360780da129e4110f43ab9a12922dfd (patch)
treef2731e6a2912d24570b8b0ce8592c084ee19d82e
parentef50c6f7df8337b94b0a4c63da71151d3b24de62 (diff)
parent801fa3882348ed265c9952210a08c59332a203e4 (diff)
downloadlibcore-593d18f40360780da129e4110f43ab9a12922dfd.zip
libcore-593d18f40360780da129e4110f43ab9a12922dfd.tar.gz
libcore-593d18f40360780da129e4110f43ab9a12922dfd.tar.bz2
am 801fa388: Merge "Add exceptions for test_connectLjava_net_SocketAddressI"
* commit '801fa3882348ed265c9952210a08c59332a203e4': Add exceptions for test_connectLjava_net_SocketAddressI
-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 6575d8c..edc564c 100644
--- a/luni/src/test/java/libcore/java/net/OldSocketTest.java
+++ b/luni/src/test/java/libcore/java/net/OldSocketTest.java
@@ -1241,6 +1241,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: "
@@ -1256,6 +1262,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: "