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 13:34:03 UTC 2026
On Mon, 26 Jan 2026 13:18:52 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> skip the test if the SocketChannel unexpectedly connects to the destination address
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29409#discussion_r2727616602
More information about the net-dev
mailing list