Does someone know what can be wrong in configuration, that I getting such exception:
javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0x71c528b200:
I/O error during system call, Connection reset by peer
And how to configure this for AsyncHttpClient (com.loopj.android:android-async-http:1.4.9)?
I am using the next configuration:
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.PersistentCookieStore;
import com.loopj.android.http.MySSLSocketFactory;
import cz.msebera.android.httpclient.Header;
import cz.msebera.android.httpclient.message.BasicHeader;
public class ProductsRestService {
public AsyncHttpClient getHttpClient() {
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
asyncHttpClient.setCookieStore(new PersistentCookieStore(getContext()));
KeyStore trustStore;
try {
trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(null, null);
MySSLSocketFactory socketFactory = new MySSLSocketFactory(trustStore);
socketFactory.setHostnameVerifier(AppSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
asyncHttpClient.setSSLSocketFactory(socketFactory);
} catch (Exception e) {
}
asyncHttpClient.setURLEncodingEnabled(true);
return asyncHttpClient;
}
}
I have found that this is probably different versions of TLS, but then not sure how to configure Async client.
The same I have tried for Retrofit:
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl(HOST)
.addConverterFactory(GsonConverterFactory.create());
Retrofit retrofit = builder.build();
RetrofitCallService callTokenService = retrofit.create(RetrofitCallService.class);
Call<String> tokens = callTokenService.getToken();
Headers headers = null;
try {
headers = tokens.execute().headers();
} catch (IOException e) {
e.printStackTrace();
}
List<String> values = headers.values("Content-Type");
Result the same exception. Not really sure in which direction I should search.
Thanks a lot for any help!