[英]How to resolve org.apache.http.conn.ConnectTimeoutException in Http Request to another server?
I am using HttpClient to handling http requests and when I try to contect with my target server I am getting a error as 我正在使用HttpClient来处理http请求,当我尝试与目标服务器发生冲突时,我收到错误
org.apache.http.conn.ConnectTimeoutException: Connect to prdalonegk.alonegk.com:9090 timed out
where prdalonegk.alonegk.com:9090
is my xmpp server 其中
prdalonegk.alonegk.com:9090
是我的xmpp服务器
Make sure the host prdalonegk.alonegk.com
is reacheable 确保主机
prdalonegk.alonegk.com
可以访问
ping prdalonegk.alonegk.com
and that it is can accept connections on port 9090
(firewall). 并且它可以接受端口
9090
(防火墙)上的连接。
If all is ok, then try to increase the connection timeout: 如果一切正常,那么尝试增加连接超时:
RequestConfig.Builder requestBuilder = RequestConfig.custom();
requestBuilder = requestBuilder.setConnectTimeout(3000L); /* in ms */
Please refere to the request builder javadocs for all the settings you may provide. 请参阅请求构建器javadocs以了解您可能提供的所有设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.