RFR: 8376290: SocketChannel.finishConnect() contains confusing "getsockopt" in exception message for a failed connect() on Windows [v3]

Jaikiran Pai jpai at openjdk.org
Mon Jan 26 14:03:23 UTC 2026


On Mon, 26 Jan 2026 13:31:40 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> test/jdk/java/nio/channels/Selector/ConnectionRefusedMessage.java line 90:
>> 
>>> 88:                         // this test checks the exception message of a ConnectException, so it's
>>> 89:                         // OK to skip the test if something unexpectedly accepted the connection
>>> 90:                         throw new TestAbortedException("unexpectedly connected to " + destAddr);
>> 
>> Could this use the assumptions API too? Only asking because we've now got a mix of assumptions API and TestAbortedException.
>
> The reason I used the exception type directly was it looked a bit odd to read something like:
> 
> 
> boolean success = sc.finishConnect();
> if (success) {
>     // this test checks the exception message of a ConnectException, so it's
>     // OK to skip the test if something unexpectedly accepted the connection
>     assumeTrue(success, "unexpectedly connected to " + destAddr);
> }
> fail("ConnectException was not thrown");
> 
> 
> but I don't have a strong preference here. I'll switch to using the `Assumptions.assumeXXX` API.

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29409#discussion_r2727720793


More information about the net-dev mailing list