无法通过代理隧道。代理返回" HTTP / 1.1 407需要代理身份验证

时间:2018-04-16 05:59:57

标签: java

我遇到了一个问题,我在这里附上了我的代码。我曾尝试过设置

  

jdk.http.auth.tunneling.disabledSchemes =

     

jdk.http.auth.proxying.disabledSchemes =

在jdk1.8.0_111 / jre / lib / net.properties

我仍然遇到同样的问题:

public static void main(String args[]) throws IOException, JSONException{

    System.setProperty("https.proxyUse", "true");
    System.setProperty("https.proxyHost", "192.168.1.5");
    System.setProperty("https.proxyPort", "29842");

    System.setProperty("https.proxyUserName", "lavan");
    System.setProperty("https.proxyPassword", "lavan1234");

    final URL url = new URL("https://api.ipify.org/");

    final URLConnection urlConnection = url.openConnection();

    urlConnection.setDoOutput(true);
    urlConnection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
    urlConnection.connect();

    final InputStream inputStream = urlConnection.getInputStream();
    String isss = convertStreamToString(inputStream);

    System.out.println(isss);

}

0 个答案:

没有答案