History log of /libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/ServerSocketChannelTest.java
Revision Date Author Comments
bf48d2be36b35619309c70dce565d98cc3d17b1b 25-Jul-2014 Samuel Rats <samuel.rats@gmail.com> Fix Harmony-707 test for CTS

Change the way Harmony-707 test works.
We cannot check timeouts equality, as timeout is approximated
by the Linux Kernel (see set_sock_timeout() in net/core/sock.c).

Previously, testing with the value provided to setSoTimout()
could fail, depending on the Kernel configuration:
- On a device running a kernel compiled with CONFIG_HZ=100,
it would work
- On a device running a kernel compiled with CONFIG_HZ=250,
it would not:
* Kernel stored a timeout of 3 (3.49975 cast to long)
*timeo_p = tv.tv_sec*HZ + (tv.tv_usec+(1000000/HZ-1))/(1000000/HZ)
with tv.tv_sec=0, tv.tv_usec=10000 (10ms), and HZ=250
* Kernel returned a timeout of 12ms
v.tm.tv_usec = ((sk->sk_rcvtimeo % HZ) * 1000000) / HZ
with sk->sk_rcvtimeo=3 and HZ=250

Instead, we have to ensure that the timeout is not reset to the
internal default timeout after calling accept():
- set a timeout
- immediately retrieve it and store it (this value may differ
from the previously set value)
- call accept()
- retrieve and check the timeout with the previously stored
timeout

Change-Id: I7f05c6843d9e48e6d696dca17173fce028a45a68
Signed-off-by: Samuel Rats <samuel.rats@gmail.com>
0aff1dd0b4be1b8d8cb45b59079ca883a1b3205a 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

(cherry-pick of 63744c884dd4b4f4307f2b021fb894af164972af.)

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
63744c884dd4b4f4307f2b021fb894af164972af 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
47ae0b5a1d96c8030e0963ccc5b44c3ee66aaec3 20-Jan-2014 Neil Fuller <nfuller@google.com> Implementing bind() and getLocalAddress() for NIO2.

This change introduces NetworkChannel, but only bind() and
getLocalAddress() methods. To avoid breaking existing Android
applications that extend ServerSocketChannel, DatagramChannel and
SocketChannel the methods have been added with concrete
implementations that throw exceptions rather than leaving them
abstract.

In channel tests, usages of channel.socket().bind() and
channel.socket().getLocalSocketAddress() have been changed to
channel.bind() and channel.getLocalAddress(), since the behavior is
close enough and the tests should be written against the channel APIs
as much as possible. Tests have been added for new methods.

Removed further overriding in
DatagramChannelImpl.DatagramSocketAdapter and
SocketChannelImpl.SocketAdapter which revealed some bugs and lack of
clarity in the docs for the socket methods:

Improved the documentation for DatagramSocket.getLocalAddress(),
DatagramSocket.getLocalSocketAddress(),
ServerSocket.getInetAddress(), ServerSocket.getLocalPort(),
ServerSocket.getLocalSocketAddress(), Socket.getLocalAddress(),
Socket.getLocalPort(), Socket.getLocalSocketAddress(). These methods
treat special cases differently.

Fixed a bug in DatagramSocket.getLocalSocketAddress() where it would
incorrect throw an exception if the socket has been closed, which
contradicts the (updated) documentation and the RI. It now returns
null. Added tests.

Fixed a bug in Socket.close(): a closed socket would still report as
being connected. Added tests.

Fixed a bug in Socket.startupSocket() - the socket was recording it
was being bound, but was not updating the cached local address. This
method is called during ServerSocketChannel.accept() and would cause
the socket to report its local address as being the wildcard address,
when it is not. Added a test.

Change-Id: Ibec8527e1c72597e268d23e6c1f03eb16e46cdc4
Bug: 12464155
82c642531ba3c9ad29cb3125f7547a226b661b11 02-Jan-2014 Narayan Kamath <narayan@google.com> Delete Support_PortManager & OldDatagramSocketTest

Support_PortManager didn't really work, so rewrite all tests
that use it.

Also, dedup OldDatagramSocketTest with the harmony DatagramSocketTest.

Fix various broken test cases and terribly written tests.

bug: 11689863

Change-Id: I4efb9e02eb88517273fff50a0dec1d0262feafb2
e5fea3d504609d22337a5311d3ce0e72314bceee 15-Nov-2013 Narayan Kamath <narayan@google.com> Use a consistent package path for harmony tests.

Harmony was never consistent about where they put their
tests. There's no reason we have to be the same.

Also, there's no need to have separate subtrees for nio,
nio_char etc. etc.

This change makes all existing apache harmony tests
subpackages of "org.apache.harmony.tests" and put them under
libcore/harmony-tests.

We somehow managed to end up with two vastly different
copies of CharsetDecoderTest & CharsetEncoderTest. I've
renamed the copies CharsetDecoder2Test & CharsetEncoder2Test
to avoid having to go in and resolve the complicated
diffs or speculate about the reasons for their
divergence.

Change-Id: Ic34e69c2faab8893edd54e05eccd7091f4a09abd