History log of /libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/MockServerSocketChannel.java
Revision Date Author Comments
933fbbf606268eec9fc430632b8bca7002a833b3 14-Jan-2014 Neil Fuller <nfuller@google.com> Refactoring in preparation for NIO2 changes.

Making the various Socket/Channel classes more consistent with each
other for synchronizing state between the Channel, Socket and the OS.
This is in preparation for NetworkChannel.bind().
Synchronizing state revealed a test that relied upon a Socket from a
channel not reporting isConnected() properly after a connect(). Tests
have been updated.

Reading the local address back from the OS revealed that Android is
using IPv6 and reports the string equivalent of IPv4's 0.0.0.0 as
"::". Updated a test that was relying on the string form.

Calling connect() twice on a DatagramSocket appears inconsistent with
itself and Channel and other Sockets. A pure DatagramSocket switches
over to the new remote address. I have changed the Channel-backed
DatagramSocket to throw an IllegalStateException exception, and have
created a bug to discuss making the calls more consistent.

Socket has been modified to avoid using the address field to store
the local address after a bind(). This field is documented as holding
the remote address, not the local.

Changed implementation of SocketChannelImpl.socket().getInputStream()
and SocketChannelImpl.socket().getOutputStream() to use the one that
is implemented by Socket and not a custom NIO-based implementation.
The use of NIO provided two parallel implementations for the same
thing. This change alters behavior when attempting to read zero bytes
and when a Channel is in non-blocking mode: now it throws
IllegalBlockingModeException rather than
ArrayIndexOutOfBoundsException. The tests have been updated.

Various tidying up changes to introduce @Override, remove
unnecessarily initialized local variables, fields, semi-colons,
javadocs and imports. Added close() calls for objects during tests
that were cluttering the logs.

Modified IoBridge.connect() to be void. Adjusted SocketChannelImpl
accordingly and tidied up impossible cases. Modified
SocketChannel.connect() so that it always returns false in
non-blocking mode. This looks like an existing bug:
it would previously have returned true, even though the connection
was potentially still pending. Tests have been added.

Also tidied up SocketChannelImpl.finishConnect() - it was potentially
resetting the isBound state.

Change-Id: Ic7943615b4b763f77e74397e0e91a62edc7d7017
bug: 12464155
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