HTTP FAILED:java.net.SocketException:recvfrom failed:ECONNRESET(由peer重置连接)

ND1*_*10_ 5 java android android-proguard retrofit2 okhttp3

在使用防护 改造时面临问题

 HTTP FAILED: java.net.SocketException: recvfrom failed: ECONNRESET
 (Connection reset by peer)
Run Code Online (Sandbox Code Playgroud)

我知道这个问题已被提出,但我面临的这个错误是来自其他场景...找到与此错误相关的链接,但我得到的没有任何正确的解决方案.

在Android中获取"SocketException:Connection by peer reset"

https://github.com/square/retrofit/issues/1027

Retrofit HTTP client通过使用body请求用于api调用.

@POST("users/new")
Call<User> createUser(@Body User user);
Run Code Online (Sandbox Code Playgroud)

我的客户

public static OkHttpClient getClient() {

        if (client == null) {
            HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
            interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
            RequestInterceptor m1RequestInterceptor = new RequestInterceptor();
            client = new OkHttpClient.Builder()
                    .connectTimeout(2, TimeUnit.MINUTES)
                    .readTimeout(2, TimeUnit.MINUTES)
                    .addInterceptor(interceptor)
                    .addInterceptor(m1RequestInterceptor)
                    .build();
        }
        return client;
    }
Run Code Online (Sandbox Code Playgroud)

保护规则

# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
Run Code Online (Sandbox Code Playgroud)

问题:当我点击服务器请求单一时间的响应将完美工作并得到服务器的响应,但当我一次点击多个请求(超过5请求到服务器)获取HTTP FAILED: java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

注意:没有proguard就可以正常工作,但是当我添加proguard时,我得到了上述问题

我也有这个链接 - > https://github.com/square/retrofit/issues/1027 - >但它很接近,没有得到任何解决方案.