8221259: New tests for java.net.Socket to exercise long standing behavior

Chris Hegarty chris.hegarty at oracle.com
Thu Mar 21 16:06:59 UTC 2019


Alan,

On 21/03/2019 15:06, Alan Bateman wrote:
> There are a number of tests in niosocketimpl-branch of the sandbox that 
> are needed to exercise Socket in ways that aren't fully exercised by the 
> existing tests. I'd like to bring some of these tests into jdk/jdk in 
> advance of the new NIO based SocketImpl, specifically:
> 
> - AsyncShutdown: invoke shutdownInput/shutdownOutput when a thread is 
> blocked in read/write
> - ConnectionReset: tests the behavior specified by 
> Socket::getInputStream for cases where a connection is reset with data 
> and no data available
> - UdpSocket: uses a deprecated Socket constructor to create UDP socket
> - Timeouts: test timed connect, read and accept operations. This tests 
> several scenarios that the existing tests using timeouts do not exercise.
> 
> The webrev with the tests is here:
>    http://cr.openjdk.java.net/~alanb/8221259/webrev/

This is great. Nice compact self-contained tests.

Very timely, I'm just preparing a patch to resolve 8219446: "Specify
behaviour of timeout accepting methods of Socket and ServerSocket if
timeout is negative".  I will drop the tests for IAE, since you already
have it covered.  You can drop the comment in the that test which states
that the behaviour is unspecified, or I will remove it as part of
8219446. Whichever is pushed first I guess.

-Chris.


More information about the net-dev mailing list