summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Xie <dxie@google.com>2015-06-08 18:32:15 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-06-08 18:32:15 +0000
commit9e80da3afc1f8c89bef5bab58905bd618c9e7d30 (patch)
tree820bd79ae46e661f84f4ab514103c2b8a78bfdb8
parent81a0cd7760edf6f06977ebfc5ec4633f17352078 (diff)
parent7329657b7087ab1a1411c8911edd9c392f415969 (diff)
downloadlibcore-9e80da3afc1f8c89bef5bab58905bd618c9e7d30.zip
libcore-9e80da3afc1f8c89bef5bab58905bd618c9e7d30.tar.gz
libcore-9e80da3afc1f8c89bef5bab58905bd618c9e7d30.tar.bz2
am 7329657b: Merge "Add exceptions for test_connectLjava_net_SocketAddressI" into lollipop-cts-dev automerge: 2016dc6
* commit '7329657b7087ab1a1411c8911edd9c392f415969': 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 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: "