在HttpsURLConnection中使用HttpDelete时,在libcore.io.Streams.readAsciiLine(Streams.java:203)处发生EOFException

我面对的是一个错误消息

java.io.EOFException at libcore.io.Streams.readAsciiLine(Streams.java:203) at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579) at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177) at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271) com.example.rest.MainActivity.excutePost(MainActivity.java:354) at com.example.rest.MainActivity$1.run(MainActivity.java:86) at java.lang.Thread.run(Thread.java:841) 

和我的代码是

 URL url = new URL(url); con = (HttpsURLConnection) url.openConnection(); con.setRequestProperty("Content-Language", "en-US,en;q=0.8"); con.setRequestProperty("userID", "user20@yahoo.com"); con.setRequestProperty("password", "xyz123"); con.setRequestMethod(HttpDelete.METHOD_NAME); con.setRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Accept", "*/*"); con.addRequestProperty("Accept-Encoding", "gzip"); InputStream inputStream = con.getInputStream(); String convertInputStreamToString = convertInputStreamToString(inputStream); 

我已经尝试了这些链接

  • Android HttpUrlConnection EOFException
  • Android HttpsUrlConnection eofexception
  • Android的HttpURLConnection抛出EOFException

Solutions Collecting From Web of "在HttpsURLConnection中使用HttpDelete时,在libcore.io.Streams.readAsciiLine(Streams.java:203)处发生EOFException"