Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a proxy using host/port builder options results in UnresolvedAddressException #140

Closed
utwyko opened this issue Jul 21, 2017 · 1 comment
Assignees
Milestone

Comments

@utwyko
Copy link
Contributor

utwyko commented Jul 21, 2017

When I set a proxy on my Http Client using the .host and .port setters, I get an UnresolvedAddressException.

Code:

HttpClient.builder()
        .options(ops -> ops
                .host("jsonplaceholder.typicode.com")
                .port(80)
                .proxy(proxyOps -> proxyOps.host("36.76.105.159").port(53281).type(ClientProxyOptions.Proxy.HTTP).build()))
        .build();

Exception:

java.nio.channels.UnresolvedAddressException: null
	at sun.nio.ch.Net.checkAddress(Net.java:101) ~[na:1.8.0_131]
	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622) ~[na:1.8.0_131]
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:83) ~[netty-common-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:80) ~[netty-common-4.1.13.Final.jar:4.1.13.Final]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_131]
	at io.netty.util.internal.SocketUtils.connect(SocketUtils.java:80) ~[netty-common-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:337) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:254) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1266) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.connect(CombinedChannelDuplexHandler.java:497) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannelDuplexHandler.java:298) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.handler.proxy.ProxyHandler.connect(ProxyHandler.java:181) ~[netty-handler-proxy-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:50) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:512) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:985) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:255) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:252) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) ~[netty-common-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[netty-common-4.1.13.Final.jar:4.1.13.Final]
	at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_131]

Using the .address setter, everything works fine:

HttpClient.builder()
        .options(ops -> ops
                .host("jsonplaceholder.typicode.com")
                .port(80)
                .proxy(proxyOps -> proxyOps.address(InetSocketAddress.createUnresolved("36.76.105.159", 53281)).type(ClientProxyOptions.Proxy.HTTP).build()))
        .build();

Reactor Netty version

0.7.0.M1

@violetagg violetagg self-assigned this Jul 21, 2017
@violetagg violetagg added this to the 0.7.0.M2 milestone Jul 21, 2017
@violetagg
Copy link
Member

#141 should address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants