2015-11-02 45 views
0

當我使用調度發出GET請求時發生了什麼?我可以使用代理,但我不能使用需要認證的代理。調度失敗,需要進行身份驗證的代理服務器:遠程關閉的連接

這工作:

val ps = new ProxyServer(host, port) 
val svc = request.setProxyServer(ps) 
val resp = Http(svc > as.String)   

這種失敗:

val ps = new ProxyServer(host, port) 
val svc = request.setProxyServer(ps).as_!(user, pass) 
val resp = Http(svc > as.String) 

的錯誤是:

java.util.concurrent.ExecutionException: java.io.IOException: Remotely Closed 
    at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:342) 
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.abort(NettyAsyncHttpProvider.java:1418) 
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.channelClosed(NettyAsyncHttpProvider.java:1485) 
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:88) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) 
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) 
    at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) 
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) 
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:570) 
    at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) 
    at org.jboss.netty.handler.codec.http.HttpClientCodec$Decoder.channelClosed(HttpClientCodec.java:221) 
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:88) 
    at org.jboss.netty.handler.codec.http.HttpClientCodec.handleUpstream(HttpClientCodec.java:92) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) 
    at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) 
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:375) 
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:93) 
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) 
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) 
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) 
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) 
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) 
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.io.IOException: Remotely Closed 

回答

2
val svc = request.setProxyServer(ps).as_!(user, pass) 

正在爲請求的用戶名和密碼,而不是代理

您應該實例訪問代理服務器與用戶名和密碼信息:

ProxyServer(String host, int port, String principal, String password) 

reference

在您的例子:

val ps = new ProxyServer(host, port, user, pass) 
val svc = request.setProxyServer(ps) 
val resp = Http(svc > as.String) 
相關問題