【发布时间】:2021-04-22 07:22:40
【问题描述】:
您好,我正在使用HttpsURLConnection 连接外部服务,它适用于少数事务,但一段时间后它会失败并出现以下错误
Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Forbidden
我打印connection.getErrorStream() 它给了null
请在下面找到它在 os = connection.getOutputStream(); 处失败的代码
connection = restConfiguration.getSSLConnection(url, connection);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
connection.setRequestProperty("Accept", "application/json; charset=UTF-8");
connection.setRequestProperty("Authorization", "Bearer " + authorization);
os = connection.getOutputStream();
os.write(signOrderRequest.toJson().getBytes("UTF-8"));
os.flush();
有什么建议、想法吗?
【问题讨论】:
-
什么是
restConfiguration? -
它是我们连接到 ssl 方法的对象
标签: java spring-mvc https http-proxy