package me.fallenbreath.playground;
import org.asynchttpclient.proxy.ProxyType;
import static org.asynchttpclient.Dsl.*;
public class Main
{
public static void main(String[] args) throws Exception
{
var proxyServer = proxyServer("127.0.0.1", 1081).
setProxyType(ProxyType.SOCKS_V5);
try (var client = asyncHttpClient(config().setProxyServer(proxyServer)))
{
var response = client.prepareGet("https://cloudflare.com/cdn-cgi/trace").execute().get();
System.out.println(response);
}
}
}
Exception:
Exception in thread "main" java.util.concurrent.ExecutionException: java.net.ConnectException: socks
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:210)
at me.fallenbreath.playground.Main.main(Main.java:16)
Caused by: java.net.ConnectException: socks
at org.asynchttpclient.netty.channel.NettyConnectListener.onFailure(NettyConnectListener.java:173)
at org.asynchttpclient.netty.channel.NettyConnectListener.onSuccess(NettyConnectListener.java:109)
at org.asynchttpclient.netty.channel.NettyChannelConnector$1.onSuccess(NettyChannelConnector.java:91)
at org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:28)
at org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:22)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:300)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:335)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.util.NoSuchElementException: socks
at io.netty.channel.DefaultChannelPipeline.getContextOrDie(DefaultChannelPipeline.java:1073)
at io.netty.channel.DefaultChannelPipeline.addAfter(DefaultChannelPipeline.java:302)
at io.netty.channel.DefaultChannelPipeline.addAfter(DefaultChannelPipeline.java:290)
at org.asynchttpclient.netty.channel.ChannelManager.addSslHandler(ChannelManager.java:427)
at org.asynchttpclient.netty.channel.NettyConnectListener.onSuccess(NettyConnectListener.java:107)
... 21 more
The issue only occurs with socks5 + https. Sock4 is not tested, and http proxy works normally
To reproduce
Exception:
The issue only occurs with socks5 + https. Sock4 is not tested, and http proxy works normally
Environment:
org.asynchttpclient:async-http-client:3.0.0.Beta2