diff options
author | Daniel Xie <dxie@google.com> | 2015-06-04 17:47:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-06-04 17:47:13 +0000 |
commit | 2016dc66a98087c57a15d097fcd04e1ed171e57c (patch) | |
tree | 3affa13e9fa7ded99c069f4c556c970a21772d56 /luni | |
parent | 27ef0eb26e179b7750b9cb72018da9fab3a0bbb0 (diff) | |
parent | b66e876c96fbc9c789d4159d4ab7647faea255e4 (diff) | |
download | libcore-2016dc66a98087c57a15d097fcd04e1ed171e57c.zip libcore-2016dc66a98087c57a15d097fcd04e1ed171e57c.tar.gz libcore-2016dc66a98087c57a15d097fcd04e1ed171e57c.tar.bz2 |
Merge "Add exceptions for test_connectLjava_net_SocketAddressI" into lollipop-cts-dev
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: " |