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

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


On Fri, 13 Dec 2024 16:34:28 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:
>> 
>>   Rename `proxiedSocket` to `noProxySocket`
>
> test/jdk/java/net/Socket/ConnectSocksProxyTest.java line 82:
> 
>> 80:     @BeforeAll
>> 81:     static void initProxyServer() throws IOException {
>> 82:         PROXY_SERVER = new SocksServer(0);
> 
> We should use the constructor that takes an InetAddress and pass the loopback address here.

Fixed in 9706ef9c7c362829daa7cc3ea845a85e36bf92c4.

> test/jdk/java/net/Socket/ConnectSocksProxyTest.java line 164:
> 
>> 162:     void testBoundSocketWithUnresolvedAddress() throws IOException {
>> 163:         try (Socket socket = createProxiedSocket()) {
>> 164:             socket.bind(new InetSocketAddress(0));
> 
> if the server is bound to the loopback, we should use the loopback here too

Fixed in 9706ef9c7c362829daa7cc3ea845a85e36bf92c4.

> test/jdk/java/net/Socket/ConnectSocksProxyTest.java line 177:
> 
>> 175:         try (ServerSocket serverSocket = createEphemeralServerSocket()) {
>> 176:             InetSocketAddress unresolvedAddress =
>> 177:                     InetSocketAddress.createUnresolved("localhost", serverSocket.getLocalPort());
> 
> Suggestion:
> 
>                     InetSocketAddress.createUnresolved(getLoopbackAddress().getHostAddress(), serverSocket.getLocalPort());

Fixed in 9706ef9c7c362829daa7cc3ea845a85e36bf92c4.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22719#discussion_r1886457851
PR Review Comment: https://git.openjdk.org/jdk/pull/22719#discussion_r1886457715
PR Review Comment: https://git.openjdk.org/jdk/pull/22719#discussion_r1886457630


More information about the net-dev mailing list