Reputation: 91
I am using retrofit to pass data to server. But getting following exception in response :
okhttp3.internal.http2.StreamResetException: stream was reset: REFUSED_STREAM
I referred following links for the above exception: java.io.IOException: stream was reset: REFUSED_STREAM on several devices
and updated retrofit and okhttp versions to following :
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.5.0'
Still issue is not resolved. How to fix it?
Upvotes: 9
Views: 15267
Reputation: 838
It's too late to response and it's possible you got it the fix but in my case, I resolve the problem adding protocols in the OKHttpClient
:
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.protocols( Collections.singletonList(Protocol.HTTP_1_1) );
Regards!
Upvotes: 17