diff options
author | Daniel Xie <dxie@google.com> | 2015-06-08 17:10:35 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-06-08 17:10:35 +0000 |
commit | 7329657b7087ab1a1411c8911edd9c392f415969 (patch) | |
tree | 820bd79ae46e661f84f4ab514103c2b8a78bfdb8 /luni | |
parent | b96afd7caf4486aa3306b62c08f43a660b5bf8f8 (diff) | |
parent | 2016dc66a98087c57a15d097fcd04e1ed171e57c (diff) | |
download | libcore-7329657b7087ab1a1411c8911edd9c392f415969.zip libcore-7329657b7087ab1a1411c8911edd9c392f415969.tar.gz libcore-7329657b7087ab1a1411c8911edd9c392f415969.tar.bz2 |
Merge "Add exceptions for test_connectLjava_net_SocketAddressI" into lollipop-cts-dev
automerge: 2016dc6
* commit '2016dc66a98087c57a15d097fcd04e1ed171e57c':
Add exceptions for test_connectLjava_net_SocketAddressI
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/test/java/libcore/java/net/OldSocketTest.java | 12 |
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: " |