2808d7d77be71a40b9724172fc6be4c3db68d507 |
|
10-Aug-2015 |
Narayan Kamath <narayan@google.com> |
SocketChannel fixes. - Be more consistent about the type of exception that's being thrown (nio "style" vs SocketExceptions). - Convert AlreadyConnectedException correctly. - Update test expectations. - Remove a pointless test of hasArray() for direct byte buffers. It is not this tests responsibility. Change-Id: I9e47670fbdd24546b9f219dafb6371b086928c95
|
3d43823e17818b3c5f45831f830884917b181454 |
|
05-May-2015 |
Piotr Jastrzebski <haaawk@google.com> |
Use OpenJdk implementation of java.nio.channels.{spi}.* - Unsafe : Add supporting methods (addressSize, pageSize, allocateMemory, freeMemory, setMemory and various getters equivalent to the existing libcore Memory classes). - NioUtils : Rewrite nioutils methods in terms of OpenJdk classes. - DeleteOnExitHook : Access java.lang.Shutdown directly. - FileDescriptor : Add getInt$, setInt$ and setSocket. - NativeBuffers : Copy byte-by-byte instead of using Unsafe.copyMemory. - FileInputStream : Add a custom implementation of available() instead of using IO_Available. General : Switch JNI code to explicit registration rather than implicit registration. General : Track renaming of Unsafe methods (to add the $ suffix). This might be unnecessary and will be reverted in a future change. Change-Id: I7e63340d266dbd4b1c425b13710c05dce1086d4b
|
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
|
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
|
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
|