The following error occurs: javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0xbe6af938: I/O error during system call, Connection reset by peer
Retrofit class:
public class RetrofitClientInstance {
private static Retrofit retrofit;
public static Retrofit getRetrofitInstance() {
if (retrofit == null) {
Gson gson = new GsonBuilder().setLenient().create();
retrofit = new retrofit2.Retrofit.Builder()
.client(HelperOkHttpClient.getOkHttpClient())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
}
}
The error / exception appears in this method:
private void makeRequestToSecondAuthStep(ArrayList<String> creds) {
AuthCheckHTTP defectSpecific = RetrofitClientInstance.getRetrofitInstance().create(AuthCheckHTTP.class);
Observable<ResponseSingleRequestAuth<Object>> observableDefectsRelated = defectSpecific.getAuthCheck();
observableDefectsRelated
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(specficDefects -> {
Log.w("ASYNCLI", "In defectspecif");
if (HelperIsNull.isNull(creds.get(3))) {
creds.set(3, creds.get(5));
}
DataBaseHelper.deleteAllData();
PublisherNotificationSync.getInstance().setLastSyncDate(INITIAL_DATE);
writeCredentialsToLocalDb();
actMain.runOnUiThread(new Runnable() {
@Override
public void run() {
presenterAuthAct.downloadData();
}
}
);
})
.doOnError(
throwable -> {
...
}
).doOnComplete(() -> {
}).subscribe(new Observer<ResponseSingleRequestAuth<Object>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(ResponseSingleRequestAuth<Object> objectResponseSingleRequestAuth) {
}
@Override
public void onError(Throwable e) {
// do nothing
}
@Override
public void onComplete() {
}
});
}
}
Maybe somehow you can add standards (SSL) to this Retrofit class, could anyone have encountered this or a similar problem before?
What could be the problem? A few months ago - everything worked, the project was not touched (archived) Thank you in advance
UPD: nothing to do with the certificate, this is SAP, they update themselves
I'm not sure there's enough info here for me to accurately diagnose your problem but the error indicates an SSL handshake error, which would normally, to me, indicate the problem isn't in the code, but in the certs/acceptable encryption algorithms for the communication channel.
Retrofit is a REST framework, so I'm assuming you wrote an API on top of it and retrofit handles your HTTP sessions and SSL stuff. You said the solution suddenly stopped working. Is your retrofit dependency up to date? Maybe bring your dependencies up to date, repackage your application and see if that works?