IOException:javax.net.ssl.SSLHandshakeException:SSL 握手中止:ssl=0xafdb8e00:系统调用期间的 I/O 错误,对等方重置连接
Posted
技术标签:
【中文标题】IOException:javax.net.ssl.SSLHandshakeException:SSL 握手中止:ssl=0xafdb8e00:系统调用期间的 I/O 错误,对等方重置连接【英文标题】:IOException : javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0xafdb8e00: I/O error during system call, Connection reset by peer 【发布时间】:2016-05-29 13:22:21 【问题描述】:嘿,我有一个 http 请求,今天它工作正常我收到一个错误
IOException : javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0xafdb8e00: I/O error during system call, Connection reset by peer
这就是我执行完美请求的方式
try
Url = new URL(url);
urlConnection = (HttpURLConnection) Url.openConnection();
urlConnection.setRequestMethod("POST");
urlConnection.setUseCaches(false);
urlConnection.setConnectTimeout(30000);
urlConnection.setReadTimeout(30000);
urlConnection.setRequestProperty("Content-Type", "text/xml");
urlConnection.setRequestProperty("Host", "host");
String body = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \n" +
" <soap:Body> \n" +
xml data
" </soap:Body> \n" +
" </soap:Envelope>";
System.out.println("the body is " + body);
byte[] outputInBytes = body.getBytes("UTF-8");
OutputStream os = urlConnection.getOutputStream();
os.write(outputInBytes);
//System.out.println("Message = " + urlConnection.getResponseMessage());
System.out.println(" * 3");
//urlConnection.connect();
if (urlConnection.getResponseCode() == 200)
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
result = IOUtils.toString(in, "UTF-8");
System.out.println("Salik Success is" + result);
os.close();
return result;
else
InputStream in = new BufferedInputStream(urlConnection.getErrorStream());
result = IOUtils.toString(in, "UTF-8");
System.out.println("Failure is" + result);
os.close();
return null;
catch (MalformedURLException e)
//e.printStackTrace();
result = "error";
System.out.println("MalformedURLException = " + e.toString());
catch (IOException e)
//e.printStackTrace();
result = "error";
System.out.println("IOException" + e.toString());
finally
urlConnection.disconnect();
有什么帮助吗? 问候
【问题讨论】:
javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice android的可能重复 请参考以下内容:***.com/questions/12885247/…***.com/questions/20741405/… 【参考方案1】:当互联网连接缓慢或您的应用无法连接到服务器时会发生此异常..
【讨论】:
以上是关于IOException:javax.net.ssl.SSLHandshakeException:SSL 握手中止:ssl=0xafdb8e00:系统调用期间的 I/O 错误,对等方重置连接的主要内容,如果未能解决你的问题,请参考以下文章
javax.net.ssl.SSLHandshakeException 通过 Cajo over SSL 连接时出现问题
Android ssl:javax.net.ssl.SSLPeerUnverifiedException:没有对等证书(又一次)
javax.net.ssl.SSLHandshakeException
javax.net.ssl.SSLException:收到致命警报:带有 Selenium 的协议版本
javax.net.ssl.SSLProtocolException: SSL 握手中止: ssl=0x7fa2258640: SSL 库失败,通常是协议错误