On Thu, 28 Nov 2024 15:20:29 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> test/jdk/java/net/Socket/ConnectFailTest.java line 105:
>> 
>>> 103:                 ConnectFailTest::createConnectedNioSocket,
>>> 104:                 executable -> 
>>> assertThrows(AlreadyConnectedException.class, executable));
>>> 105:     }
>> 
>> I assume that testConnectedSocket and testConnectedNioSocket could be 
>> @ParameterizedTest so it's called with a new created Socket.
>
> It would make them similar to the other test methods but would be a bit 
> strange since the test method would be called only once with a single 
> parameter set. 
> I mean, the other test methods get two sockets, but these will only ever take 
> one.

It should be called twice with a new created Socket.  Socket.connect is 
specified to throw IOException if already connected, we shouldn't be throwing 
(or testing for) AlreadyConnectedException here. It may be that 
Net.translateToSocketException is missing that mapping (we should check that).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22160#discussion_r1862390651

Reply via email to