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
|
ab762bb740405d0fefcccf4a0899a234f995be13 |
|
15-Nov-2013 |
Narayan Kamath <narayan@google.com> |
Move tests from tests/api to harmony-tests. (Take 2) This reverts commit d5e281743e55e1daa297fd8043b2d9b6e8e1bed2. The makefile issue that caused the original build break has been resolved.
|
d5e281743e55e1daa297fd8043b2d9b6e8e1bed2 |
|
15-Nov-2013 |
Narayan Kamath <narayan@google.com> |
Revert "Move tests from tests/api to harmony-tests." This reverts commit 81bf28ad31131815d0a36a43a0eca3c29aefdfcd. Breaks build Change-Id: I3f1562921ffe8fdbec36971dd65db398c27c92db
|
81bf28ad31131815d0a36a43a0eca3c29aefdfcd |
|
15-Nov-2013 |
Narayan Kamath <narayan@google.com> |
Move tests from tests/api to harmony-tests. The vast majority of cleaned up harmony tests are now in harmony-tests/src/test/org/apache/harmony/tests/ Change-Id: I56c2e484ff434b5618cf6751d602ae9f0db96b30
|