改造后java.io.EOFException

改造后java.io.EOFException,java,android,retrofit,eofexception,Java,Android,Retrofit,Eofexception,我正在尝试使用json主体向我的服务器发送POST请求。如果我的POST请求没有正文,它就可以工作。如果我有任何正文内容,我会得到这个EOFEException。如果我遗漏了任何细节,请告诉我 retrofit version 1.5.0 okhttp version 1.5.2 消息模型: public static class MyMessage{ String local; } 改装站: @POST("/user/{user_id}/message") void createM

我正在尝试使用json主体向我的服务器发送POST请求。如果我的POST请求没有正文,它就可以工作。如果我有任何正文内容,我会得到这个EOFEException。如果我遗漏了任何细节,请告诉我

retrofit version 1.5.0
okhttp version 1.5.2
消息模型:

public static class MyMessage{
    String local;
}
改装站:

@POST("/user/{user_id}/message")
void createMessage(
        @Path("user_id") long user_id,
        @Body MyMessage json,
        MyCallback cb);
日志错误:

06-10 18:25:18.575: D/Retrofit(28598): ---> HTTP POST XXX/user/1111158/message
06-10 18:25:18.575: D/Retrofit(28598): Content-Type: application/json; charset=UTF-8
06-10 18:25:18.575: D/Retrofit(28598): Content-Length: 16
06-10 18:25:18.576: D/Retrofit(28598): {"local":"xyzw"}
06-10 18:25:18.576: D/Retrofit(28598): ---> END HTTP (16-byte body)
06-10 18:25:18.579: D/Retrofit(28598): ---- ERROR XXX/user/1111158/message
06-10 18:25:18.581: D/Retrofit(28598): java.io.EOFException
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.okio.RealBufferedSource.readUtf8Line(RealBufferedSource.java:90)
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:145)
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:99)
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:568)
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:372)
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:319)
06-10 18:25:18.581: D/Retrofit(28598):  at com.squareup.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:484)
06-10 18:25:18.581: D/Retrofit(28598):  at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:71)
06-10 18:25:18.581: D/Retrofit(28598):  at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
06-10 18:25:18.581: D/Retrofit(28598):  at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:358)
06-10 18:25:18.581: D/Retrofit(28598):  at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:264)
06-10 18:25:18.581: D/Retrofit(28598):  at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:315)
06-10 18:25:18.581: D/Retrofit(28598):  at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
06-10 18:25:18.581: D/Retrofit(28598):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
06-10 18:25:18.581: D/Retrofit(28598):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
06-10 18:25:18.581: D/Retrofit(28598):  at java.lang.Thread.run(Thread.java:841)
06-10 18:25:18.581: D/Retrofit(28598): ---- END ERROR

服务器过早地关闭了连接。当然,这是服务器错误,或者至少它不喜欢您发送的内容。请尝试使用curl、postman或任何独立的http客户端,看看您的服务器是怎么说的。我也有同样的问题,我知道它不是我的服务器,因为我复制了请求的内容,并在Chrome浏览器和wokrs上使用Advance Rest客户端。这个问题只发生在android上。我正在运行API 16。服务器过早地关闭了连接。当然,这是服务器错误,或者至少它不喜欢您发送的内容。请尝试使用curl、postman或任何独立的http客户端,看看您的服务器是怎么说的。我也有同样的问题,我知道它不是我的服务器,因为我复制了请求的内容,并在Chrome浏览器和wokrs上使用Advance Rest客户端。这个问题只发生在android上。我正在运行API 16。服务器过早地关闭了连接。当然,这是服务器错误,或者至少它不喜欢您发送的内容。请尝试使用curl、postman或任何独立的http客户端,看看您的服务器是怎么说的。我也有同样的问题,我知道它不是我的服务器,因为我复制了请求的内容,并在Chrome浏览器和wokrs上使用Advance Rest客户端。这个问题只发生在android上。我正在运行API 16