On Fri, 22 Nov 2024 09:32:43 GMT, Volkan Yazıcı <[email protected]> wrote:
>> This PR, addressing 8343791, changes `Socket::connect()` methods to close
>> the `Socket` in the event that the connection cannot be established, the
>> timeout expires before the connection is established, or the socket address
>> is unresolved.
>>
>> `tier3` tests pass against the 9f00f61d3b7fa42a5e23a04f80bb4bb1a2076ef2.
>
> Volkan Yazıcı has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Improve naming in tests
test/jdk/java/net/Socket/CloseOnFailureTest.java line 162:
> 160: MockSocketImpl socketImpl = new MockSocketImpl(null, null);
> 161: try (Socket socket = new Socket(socketImpl) {}) {
> 162: InetSocketAddress address =
> InetSocketAddress.createUnresolved("no.such.host", 0xBEEF);
similar to DEADSERVERPORT
specifying a hex value, albeit a joke value, it is still a valid ephemeral
port, and distracts from the main invocation InetAddress.createUnresolved, so
consider a constant declaration for the port
private static final int NOSUCHHOSTPORT = 0xBEEF;
then the invocation is
InetAddress.createUnresolved("no.such.host", NOSUCHHOSTPORT);
presenting an unambiguous statement that the InetAddress not meant to be
reachable !
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22160#discussion_r1854729766