RFR: 8336815: Socket.bind/connect and ServerSocket.bind/accept do not specify behavior when already bound, connected or closed [v2]

Alan Bateman alanb at openjdk.org
Sat Jul 20 11:08:31 UTC 2024


On Sat, 20 Jul 2024 10:11:43 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> I had looked around in the test/jdk/java/net/Socket and test/jdk/java/net/ServerSocket tests to see if this is already tested. But I can't see anything that does this specific testing. I now decided to do a local change to the source to not throw the `IOException` when already bound/closed and reran the tests in these directories:

If there are holes in the testing then we need to fill them but I'm not sure about introducing SocketBasicExceptionsTest to test a small subset of the possible exceptions is the best approach. Also the tests for ServerSocket are in a different directory. What would you think about a ClosedSocketTest and ClosedServerServerTest (or better name) in each directory to test that the methods throw as expected, it could test that close, isXXX, ... don't throw as expected. We can do the same for bind and Socket.connect.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20268#discussion_r1685380771


More information about the net-dev mailing list