History log of /libcore/luni/src/test/java/libcore/java/net/ServerSocketTest.java
Revision Date Author Comments
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
49ff8b8582bca20a1adbda1d957220526332a8ca 06-May-2011 Elliott Hughes <enh@google.com> More networking cleanup.

Move a bit more work into Java.

Change-Id: I656ec6e3c792ce9baed32662d65c45d75af1d371