History log of /libcore/luni/src/test/java/libcore/java/net/OldSocketTest.java
Revision Date Author Comments
d982f3183750046eef2d6be6548d507018944221 14-Mar-2017 Kazuhiro Inaba <kinaba@google.com> DO NOT MERGE: Revert "Remove StuckServer using backlog and tests relying on it"

This reverts commit 8ffb0f557712e57c7dbf795b2cff79ee61c51c59.
(DO NOT MERGE because the original CL was a cherry-pick form N,
where this wasn't a problem. It breaks trees only on M.)

Bug: 35934294
(cherry picked from commit d7f172d08f54daed09c1906f24eff3e68cd50c05)

Change-Id: Id0b18389de73110f3f07f591f4272dbb50b4417b
5dcc3ce8cae450f7800570b2826f5232096159cd 20-Jan-2017 Yi Kong <yikong@google.com> DO NOT MERGE: Remove StuckServer using backlog and tests relying on it

This cherry-pick contains additional changes to remove more references
to StuckServer. The URLConnectionTest#teestConnectTimeouts() test is
suppressed in M via libcore/expectations/brokentests.txt and is not
expected to work. This change should not be merged into N branches.
(Original commit description follows below.)

StuckServer uses kernel implementation details that have changed on
version > 4.4, and causing tests depending on it to fail. Since we can't
find an alternative method to simulate a stuck server without special
permission, and the test itself is not reliable in that they don't fail
on non-stuck servers, remove them from Libcore tests.

Test: CtsLibcoreTestCases
Test: rm -rf out; m -j30 cts
Bug: 32551747
Bug: 35934294
(cherry picked from commit b5c7cd37726154f8da123e1844b5d60a63a60a2c)

Change-Id: I4dd951e9527b5ee5701c0c3ad3eaa0c6f34e8ef7
d7f172d08f54daed09c1906f24eff3e68cd50c05 14-Mar-2017 Kazuhiro Inaba <kinaba@google.com> DO NOT MERGE: Revert "Remove StuckServer using backlog and tests relying on it"

This reverts commit 8ffb0f557712e57c7dbf795b2cff79ee61c51c59.
(DO NOT MERGE because the original CL was a cherry-pick form N,
where this wasn't a problem. It breaks trees only on M.)

It didn't block 'm cts' but it broke other targets.
libcore/luni/src/test/java/libcore/java/net/URLConnectionTest.java
still had a reference to StuckServer.


Change-Id: If9486b5b552c4992536507da5460436fb8185df3
71fdb62763544446c146c7659e393434fa4ae10c 09-Mar-2017 Yi Kong <yikong@google.com> Correct references to Blackhole address RFC docs

IPv4 Blackhole 192.0.2.0/24(TEST-NET-1) is specified in RFC 5737 instead
of RFC 6666.

Bug: 34832066
Test: N/A
Change-Id: Iac0e1fc3afb65e243a1f33e8204fb1a132d6ff68
8ffb0f557712e57c7dbf795b2cff79ee61c51c59 20-Jan-2017 Yi Kong <yikong@google.com> Remove StuckServer using backlog and tests relying on it

StuckServer uses kernel implementation details that have changed on
version > 4.4, and causing tests depending on it to fail. Since we can't
find an alternative method to simulate a stuck server without special
permission, and the test itself is not reliable in that they don't fail
on non-stuck servers, remove them from Libcore tests.

(cherry picked from commit 6a5e142b16cf6b921420d371c35d950a13b22db1)

Test: CtsLibcoreTestCases
Bug: 32551747
Change-Id: I88d837329d65040a9f8550fff790f8703ea773f3
(cherry picked from commit b5c7cd37726154f8da123e1844b5d60a63a60a2c)
b5c7cd37726154f8da123e1844b5d60a63a60a2c 20-Jan-2017 Yi Kong <yikong@google.com> Remove StuckServer using backlog and tests relying on it

StuckServer uses kernel implementation details that have changed on
version > 4.4, and causing tests depending on it to fail. Since we can't
find an alternative method to simulate a stuck server without special
permission, and the test itself is not reliable in that they don't fail
on non-stuck servers, remove them from Libcore tests.

(cherry picked from commit 6a5e142b16cf6b921420d371c35d950a13b22db1)

Test: CtsLibcoreTestCases
Bug: 32551747
Change-Id: I88d837329d65040a9f8550fff790f8703ea773f3
6a5e142b16cf6b921420d371c35d950a13b22db1 20-Dec-2016 Yi Kong <yikong@google.com> Remove StuckServer using backlog and tests relying on it

StuckServer uses kernel implementation details that have changed on
version > 4.4, and causing tests depending on it to fail. Since we can't
find an alternative method to simulate a stuck server without special
permission, and the test itself is not reliable in that they don't fail
on non-stuck servers, remove them from Libcore tests.

Test: CtsLibcoreTestCases
Bug: 32551747
Change-Id: I88d837329d65040a9f8550fff790f8703ea773f3
dc7af433a10d86ebac443ac72ff5ab01a3114e2e 31-Oct-2016 Yi Kong <yikong@google.com> Fix getTrafficClass on a closed socket leaks resources

Also introduces a small behaviour change where calling getTrafficClass
on a closed socket will throw SocketException instead of returning 0.
This restores the behaviour prior to N and is more reasonable.

Bug: 31818400
Test: libcore.java.net.OldSocketTest#test_getTrafficClass_leaky
Change-Id: I4170284eab4db739fb3698cfca0f68acaa848266
(cherry picked from commit ed9613470a74302b44082688a0a981562a22ec13)
aea194e275dc88889b0e1be0c990da4adfa3cc8a 02-Nov-2016 Yi Kong <yikong@google.com> Fix merge issue for OldSocketTest

Test: libcore.java.net.OldSocketTest
Change-Id: Ie4e56e12402b77f677113b43956c877edae57075
e66872e6624e1d0f0d0b058191f61fca5cbccc6d 02-Nov-2016 Yi Kong <yikong@google.com> Fix OldSocketTest#test_connectLjava_net_SocketAddressI

Change 27604018f783bf6354a13870b3e7785edca69b5f accidently changed the
test but exposed that the test itself is incorrect. The first connect
actually already throws ConnectException, since theAddress only have a
wildcard port number.

Fixed the test to use serverSocket's local socket address.

Test: OldSocketTest#test_connectLjava_net_SocketAddressI
Change-Id: I57043359469b41d67bb04fcd3ba947214f70b17f
c62555ae97368885f7ba0b9dac7adaa0cba981d8 31-Oct-2016 Yi Kong <yikong@google.com> Fix sendUrgentData on a closed socket leaks resources

If the socket is closed, sendUrgentData should not create a new impl.
Fail early to avoid leaking resources.

Bug: 31818400
Test: libcore.java.net.OldSocketTest#sendUrgentData
Change-Id: I0e783e110e6cb55ad70f81094c4b6663fc768b4e
(cherry picked from commit 1565f7e5138c5f3571e6472d0704ed942bedfa09)
ed9613470a74302b44082688a0a981562a22ec13 31-Oct-2016 Yi Kong <yikong@google.com> Fix getTrafficClass on a closed socket leaks resources

Also introduces a small behaviour change where calling getTrafficClass
on a closed socket will throw SocketException instead of returning 0.
This restores the behaviour prior to N and is more reasonable.

Bug: 31818400
Test: libcore.java.net.OldSocketTest#test_getTrafficClass_leaky
Change-Id: I4170284eab4db739fb3698cfca0f68acaa848266
1565f7e5138c5f3571e6472d0704ed942bedfa09 31-Oct-2016 Yi Kong <yikong@google.com> Fix sendUrgentData on a closed socket leaks resources

If the socket is closed, sendUrgentData should not create a new impl.
Fail early to avoid leaking resources.

Bug: 31818400
Test: libcore.java.net.OldSocketTest#sendUrgentData
Change-Id: I0e783e110e6cb55ad70f81094c4b6663fc768b4e
27604018f783bf6354a13870b3e7785edca69b5f 28-Sep-2016 Paul Duffin <paulduffin@google.com> Detect and fix resource leakages in tests

Tests that test those classes that use CloseGuard to detect
reosurce leakages are switched to use TestCaseWithRules and
ResourceLeakageDetector.getRule() to detect any resource
leakages and the leaks fixed.

A number of tests could not be fixed due to bugs in the core
classes so a new DisableResourceLeakageDetection annotation was
added as part of this change. A method annotated with that does
not perform resource leakage detection. The affected tests were
annotated with a description and a reference to an associated
bug.

This uses try-with-resources to aid in closing resources. While
that does provide some benefits it is all too easy to change the
behavior of the test unless care is taken. To avoid that it is
important not to merge it with an existing try block such as
those which follow the following pattern:
try {... fail()} catch(..) {}
Merging them could result in the test catching and ignoring
exceptions thrown during the creation of the resource which is
almost certainly not what the test was intending.

Test: Tested with vogar and CTS
Bug: 31542223
Change-Id: Id32bb40fe04eb9719d7e6cd367abb53118b21832
969e52ff2fa0125d2f493df0511b292cb8c4107d 20-Jan-2016 Neil Fuller <nfuller@google.com> Allow some rounding on SO_TIMEOUT values

Kernels can round the value in use depending on the HZ setting.
This change allows up to 10ms of slop between the SO_TIMEOUT
value set and the one returned.

Bug: 26583607
Change-Id: I527987de20a6e10172656e1f0beeaf63419ffd77
(cherry picked from commit 6566167989735858978d062a4385104ce5eca7e3)
75e6f2957c7b1a4a8c5c9cf63fc9f5aad6ec5f06 23-Aug-2014 Elliott Hughes <enh@google.com> DO NOT MERGE : Work around the snappily-titled ICANN "Name Collision Occurrence Management Framework".

Using a non-existent TLD is now a Bad Idea.

(cherry-pick of a7d651e95e38974fa0de19247e8341df98a0b1b1.)

Bug: 17146413
Change-Id: I6a68b4609d59a6d56ba780d03ffcf24a2759db48
(cherry picked from commit fbc8a6098a0eebf183ee6ca0b96fc2165927a106)
6566167989735858978d062a4385104ce5eca7e3 20-Jan-2016 Neil Fuller <nfuller@google.com> Allow some rounding on SO_TIMEOUT values

Kernels can round the value in use depending on the HZ setting.
This change allows up to 10ms of slop between the SO_TIMEOUT
value set and the one returned.

Bug: 26583607
Change-Id: I527987de20a6e10172656e1f0beeaf63419ffd77
deeaf6f5f2875a06ddcd15d704db427834ca9da9 14-Aug-2015 Narayan Kamath <narayan@google.com> Fix toString assertions.

Partial revert of bef888b78121ece1c3.

Change-Id: I2927c43e9493c9912e0cac914d517c24ade520e0
4a2df4b5bc2a7b752d0bd790f28a1d63dac89919 20-Jul-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Fixes for libcore.java.net.OldSocketTest

java.net.preferIPv6Addresses=false, with
an exception in anyLocalAddress, which returns
a IPv6 "::".

Change-Id: I5192981e13b99ec2b1756eb7f75df1f3c9723550
b66e876c96fbc9c789d4159d4ab7647faea255e4 18-Nov-2014 Tiberiu Breana <tiberiu.a.breana@intel.com> Add exceptions for test_connectLjava_net_SocketAddressI

OldSocketTest's test_connectLjava_net_SocketAddressI would sometimes
fail on certain networks. The connection attempt to the 'non-reachable' IP
would be reset by a local router before the expected
timeout occured, thus causing the test to fail.

This change adds additional catch clauses for cases like this,
looking for ECONNREFUSED messages.

Bug: 18143878

Change-Id: I99a500d5c95cc25aa52ef231e6de43233f3e5316
Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
(cherry picked from commit d3ba3eb7a3fa67c1de2cb7a5ba999dcf91c13a91)
d8f707469e2e8ffd181169213cfd32b21a0ba554 01-Dec-2014 Jason Parks <jparks@google.com> Fix failing connection tests.

Use local servers instead of live servers.

Bug: 18575971

(cherry picked from commit 40122b34be21ad22816427c807d88a2d8fcd8b22)

Change-Id: Ia21f1a3ca8a9d7e568a3bd2af5c25771ea58bb11
40122b34be21ad22816427c807d88a2d8fcd8b22 01-Dec-2014 Jason Parks <jparks@google.com> Fix failing connection tests.

Use local servers instead of live servers.

Bug: 18575971
Change-Id: If2f736a2b5a45c713d7d0922e1c5a0b0ec9cdc4a
d3ba3eb7a3fa67c1de2cb7a5ba999dcf91c13a91 18-Nov-2014 Tiberiu Breana <tiberiu.a.breana@intel.com> Add exceptions for test_connectLjava_net_SocketAddressI

OldSocketTest's test_connectLjava_net_SocketAddressI would sometimes
fail on certain networks. The connection attempt to the 'non-reachable' IP
would be reset by a local router before the expected
timeout occured, thus causing the test to fail.

This change adds additional catch clauses for cases like this,
looking for ECONNREFUSED messages.

Bug: 18143878

Change-Id: Ia98cfe75a5abce9a53bc062d5c8e81cf2d1d63e4
Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
ca9037fc1f060c071d6711bbe31c9f9de63a0b89 12-Nov-2014 Elliott Hughes <enh@google.com> Fix OldSocketTest#test_connectLjava_net_SocketAddressI.

Use the same address as StuckServer.

Bug: 18143878
Change-Id: I3759776ed3a9d46175c4b987fa0c47b27033441d
fbc8a6098a0eebf183ee6ca0b96fc2165927a106 23-Aug-2014 Elliott Hughes <enh@google.com> Work around the snappily-titled ICANN "Name Collision Occurrence Management Framework".

Using a non-existent TLD is now a Bad Idea.

(cherry-pick of a7d651e95e38974fa0de19247e8341df98a0b1b1.)

Bug: 17146413
Change-Id: I6a68b4609d59a6d56ba780d03ffcf24a2759db48
a7d651e95e38974fa0de19247e8341df98a0b1b1 23-Aug-2014 Elliott Hughes <enh@google.com> Work around the snappily-titled ICANN "Name Collision Occurrence Management Framework".

Using a non-existent TLD is now a Bad Idea.

Bug: 17146413
Change-Id: I6a68b4609d59a6d56ba780d03ffcf24a2759db48
2b096f630d94f957b981ef511c70c856893dc47e 16-Oct-2012 Elliott Hughes <enh@google.com> Fix test flakiness.

Support_PortManager is a bad idea, badly implemented. Kill some more of it.
Only OldDatagramSocketTest still uses Support_PortManager, so hopefully we
can kill this completely soon.

Bug: 7347233
Change-Id: I9dec7b23d59edc8c7a5e391dd5ebccd2a92f82b5
ec8de076ac382cded43952ba0c2972282b09e1c7 24-Oct-2011 Elliott Hughes <enh@google.com> Fix socket timeout test failures.

The kernel uses awkward device-specific units that make tests with timeouts
that aren't integer multiples of a second awkward.

There's no common superclass for the various sockets, so we can't factor
out the test even though -- apart from the creation of the specific socket --
it's textually identical in each case. Nice library design, boys!

I've also fixed a couple of CloseGuard warnings in passing.

Bug: 5159133
Change-Id: Iaf4c9891b3cf2f5b3ebcee5cb2ba862157ab034e
04e25f30524dc7b51f280912d6ca97d991ae84b0 24-Oct-2011 Elliott Hughes <enh@google.com> Fix socket timeout test failures.

The kernel uses awkward device-specific units that make tests with timeouts
that aren't integer multiples of a second awkward.

There's no common superclass for the various sockets, so we can't factor
out the test even though -- apart from the creation of the specific socket --
it's textually identical in each case. Nice library design, boys!

I've also fixed a couple of CloseGuard warnings in passing.

Bug: 5159133
Change-Id: Iaf4c9891b3cf2f5b3ebcee5cb2ba862157ab034e
a29cfae03ee194774639c8ee7d2d69747caeacfb 07-May-2011 Elliott Hughes <enh@google.com> Test fixes.

There are many IPv4 loopback addresses in addition to IPv6's single one.

You can't connect from a mapped IPv4 address to an IPv6 (it times out), so
fix the EADDRINUSE test to finish a lot quicker.

Change-Id: Ifdc483683fa79b2adc7efb8de1b1f24efdfdc464
7e6cee7a973ebf3cdc32638580d777d9b45088ae 05-May-2011 Elliott Hughes <enh@google.com> A handful of networking test fixes.

The main thing is that some of the tests were relying on the presence of the
removed "java.net.preferIP*" properties.

Change-Id: I4cb1e99a13ed10c3ce14dad58579454a22b3416f
c08b5f81dbe5aba03208538570c5434a9dd0eb36 14-Jan-2011 Jesse Wilson <jessewilson@google.com> Fix test to agree with new Socket.toString() text.

Change-Id: Ia5471e3c0718b289e0477424e912e4e8ae55906a
aec2ed4b266b75aaab59c23ca71e355a9336b074 21-Oct-2010 Jesse Wilson <jessewilson@google.com> Remove tests for SecurityManager.

Many of the changes are to org.apache.harmony.* tests that we've copied
from upstream. We'll remove these duplicated tests completely once we
have the upstream Harmony tests properly integrated into CTS.

Change-Id: Idd6cfbeba5345156b207b9433928ee37b662c395
http://b/3102252
1f8243e3d2b5a3f8e0398c304d1dea0395cbc368 28-Sep-2010 Jesse Wilson <jessewilson@google.com> Remove java.net tests that are redundant with Harmony.

Change-Id: I01d6b3633a6de8a075982975d4cbf6c08e757490