凭证信息/gh> 检查路由器日志是否有;查看路由器是否有问题。 试着看看你的编码(例如
我有以下代码,我一直得到一个错误
public static HttpsURLConnection getRestConnectionWithProxy(String urlString) throws MalformedURLException,
IOException {
URL url = new URL(null, urlString, new sun.net.www.protocol.https.Handler());
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(getProxy());
return conn;
}
private static Proxy getProxy() {
if (proxy == null) {
Map<String, String> connectionParams = null;
String proxyIP = "proxyIP";
int proxyPort = 80;
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyIP, proxyPort));
}
return proxy;
}
我得到的错误如下
Exception: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at java.net.HttpURLConnection.getResponseMessage(HttpURLConnection.java:546)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseMessage(HttpsURLConnectionImpl.java:391)
你知道可能是什么原因导致这个错误吗?
正如您在堆栈跟踪中看到的那样,有可能与您通信的服务器在建立连接后突然关闭连接。可能是服务器暂时无法处理您的请求,或者是防火墙/路由器出现问题,导致网络数据包丢失。
可能存在诸如身份验证头丢失等问题,但无法确认共享信息有限。
你可能需要开始看
<<ol>UTF-8
)是正确的内容类型。