【问题标题】:Open webpage with Socks5 proxy in JAVA在 JAVA 中使用 Socks5 代理打开网页
【发布时间】:2016-05-11 07:19:09
【问题描述】:

我正在尝试通过 Socks5 使用代理打开页面 URL(已在服务器端创建)

Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.1", 8080));
conn = new URL(urlString).openConnection(proxy);

//Connection
Authenticator authenticator = new Authenticator() {

    public PasswordAuthentication getPasswordAuthentication() {
        return (new PasswordAuthentication("user",
                "password".toCharArray()));
    }
};
Authenticator.setDefault(authenticator); 

现在我需要使用此代理连接打开(和关闭选项?)一个 URL...

【问题讨论】:

    标签: java proxy socks


    【解决方案1】:

    现在我需要使用此代理连接打开(和关闭选项?)一个 URL...

    你已经这样做了。只需获取输入流并照常进行。

    【讨论】:

    • 你能告诉我怎么做吗? :/ 你的意思是,像这样:conn.openStream(); ?
    猜你喜欢
    • 2023-04-05
    • 1970-01-01
    • 2018-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-19
    • 2016-08-20
    • 2015-11-02
    相关资源
    最近更新 更多