Java 使用HttpsURLConnection的InputStream读取xml数据时出现意外的流结束错误

Java 使用HttpsURLConnection的InputStream读取xml数据时出现意外的流结束错误,java,android,xml,xml-parsing,xmlhttprequest,Java,Android,Xml,Xml Parsing,Xmlhttprequest,我找到了解决办法。 我没有用android内置的SSL套接字库打开套接字 02-17 11:09:33.684: W/System.err(6446): java.net.ProtocolException: unexpected end of stream 02-17 11:09:33.689: W/System.err(6446): at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(Ht

我找到了解决办法。 我没有用android内置的SSL套接字库打开套接字

02-17 11:09:33.684: W/System.err(6446): java.net.ProtocolException: unexpected end of stream
02-17 11:09:33.689: W/System.err(6446):     at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:445)
02-17 11:09:33.690: W/System.err(6446):     at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)

这两行代码浪费了我宝贵的四天:(

请从logcat添加完整的stacktrace
02-17 11:09:33.684: W/System.err(6446): java.net.ProtocolException: unexpected end of stream
02-17 11:09:33.689: W/System.err(6446):     at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:445)
02-17 11:09:33.690: W/System.err(6446):     at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
javax.net.SocketFactory fact=SSLSocketFactory.getDefault();
         socket=fact.createSocket(addr, port);