RFR: 8346017: Socket.connect specified to throw UHE for unresolved address is problematic for SOCKS V5 proxy [v2]

Volkan Yazıcı duke at openjdk.org
Mon Dec 16 09:24:16 UTC 2024


On Fri, 13 Dec 2024 10:36:06 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Volkan Yazıcı has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix `Socket::connect` javadoc
>
> test/jdk/java/net/Socket/ConnectFailTest.java line 85:
> 
>> 83:     @BeforeAll
>> 84:     static void initSocksServer() throws IOException {
>> 85:         SOCKS_SERVER = new SocksServer(0);
> 
> We should use the constructor that takes an InetAddress and bind to the loopback.
> 
> SocksServer(InetAddress addr, int port, boolean useV4)

Fixed in 9706ef9c7c362829daa7cc3ea845a85e36bf92c4.

> test/jdk/java/net/Socket/ConnectFailTest.java line 118:
> 
>> 116:     void testBoundSocket(SocketArg socketArg) throws IOException {
>> 117:         try (Socket socket = socketArg.socket) {
>> 118:             socket.bind(new InetSocketAddress(0));
> 
> If the server is bound to the loopback we could bind to the loopback here too. That should reduce potential instabilities.

Fixed in 9706ef9c7c362829daa7cc3ea845a85e36bf92c4.

> test/jdk/java/net/Socket/ConnectFailTest.java line 167:
> 
>> 165:     void testBoundSocketWithUnresolvedAddress(SocketArg socketArg) throws IOException {
>> 166:         try (Socket socket = socketArg.socket) {
>> 167:             socket.bind(new InetSocketAddress(0));
> 
> If the server is bound to the loopback we could bind to the loopback here too. That should reduce potential instabilities.

Fixed in 9706ef9c7c362829daa7cc3ea845a85e36bf92c4.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22719#discussion_r1886458207
PR Review Comment: https://git.openjdk.org/jdk/pull/22719#discussion_r1886457982
PR Review Comment: https://git.openjdk.org/jdk/pull/22719#discussion_r1886458082


More information about the net-dev mailing list