无法通过代理隧道

编程入门 行业动态 更新时间:2024-10-27 04:29:54
本文介绍了无法通过代理隧道-Jsoup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

创建HTTP连接时出现以下异常.

I am getting the below exception while creating an HTTP connection.

2017-08-07 17:07:43,219 ERROR au.scraper.sites.ScraperSite - Exception in parsing Categories: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Forbidden" at line number 153 java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Forbidden" at sun.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2085) at sun.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183) at sun.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:563) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:540) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:227) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:216) at org.jsoup.Jsoup.parse(Jsoup.java:183) at au.scraper.sites.ScraperSite.getCategories(ScraperSite.java:127) at au.scraper.sites.AScraperSites.execute(AScraperSites.java:74) at au.scraper.Scraper.main(Scraper.java:88)

以下是我的代理配置.

Authenticator.setDefault(new ProxyAuthenticator("user_name", "password")); System.setProperty("https.proxyHost", server); System.setProperty("https.proxyPort", port); System.setProperty("http.proxyHost", server); System.setProperty("http.proxyPort", port);

下面是我的Proxy Authenticator类.

Below is my Proxy Authenticator class.

package au.scraper; import java.Authenticator; import java.PasswordAuthentication; public class ProxyAuthenticator extends Authenticator { public ProxyAuthenticator(String user, String password) { this.user = user; this.password = password; } protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(user, password.toCharArray()); } private String user; private String password; }

任何人都可以提出发生此问题的原因吗?

Can any one suggest why this issue is happening?

推荐答案

您的代理服务器可能会阻止该网址,当该网址是本地地址而您的代理服务器将阻止该网址时,我们可能会遇到此问题.

Your proxy server might be blocking that web address, we might face this issue when the web address is local address and your proxy server will be blocking that.

更多推荐

无法通过代理隧道

本文发布于:2023-10-07 12:39:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469404.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:隧道

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!