[JDK 10] RFR: 8185852: HttpConnection should resolve addresses before SocketChannel.connect() is called

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[JDK 10] RFR: 8185852: HttpConnection should resolve addresses before SocketChannel.connect() is called

Daniel Fuchs
Hi,

Please find below a small fix for
8185852: HttpConnection should resolve addresses before
SocketChannel.connect() is called
https://bugs.openjdk.java.net/browse/JDK-8185852

http://cr.openjdk.java.net/~dfuchs/webrev_8185852/webrev.00/

The issue here is that ProxySelector.getDefault() may return
java.net.Proxy instances whose SocketAddress are unresolved.

We need to attempt address resolution before calling
SocketChannel.connect, otherwise a
java.nio.channels.UnresolvedAddressException
is raised.

Rather than using ProxySelector.getDefault() the test forces
the creation of a ProxySelector from an unresolved address.
Fails without the fix and passes with it.

The legacy HTTP stack is used before the real test to verify
that all communication channels are working (would detect test
bugs).

best regards,

-- daniel
Reply | Threaded
Open this post in threaded view
|

Re: [JDK 10] RFR: 8185852: HttpConnection should resolve addresses before SocketChannel.connect() is called

Chris Hegarty

On 4 Aug 2017, at 10:14, Daniel Fuchs <[hidden email]> wrote:

Hi,

Please find below a small fix for
8185852: HttpConnection should resolve addresses before SocketChannel.connect() is called
https://bugs.openjdk.java.net/browse/JDK-8185852

http://cr.openjdk.java.net/~dfuchs/webrev_8185852/webrev.00/

This looks good Daniel.  We have similar test tunnelling proxy server code elsewhere, maybe an area for *future* cleanup/consolidation in a localised HTTP test library.

-Chris.