出现以下错误:
javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0xbe6af938: I/O error during system call, Connection reset by peer
改造类:
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;
}
}
该方法出现错误/异常:
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() {
}
});
}
}
也许你可以以某种方式向这个 Retrofit 类添加标准(SSL),有人以前遇到过这个或类似的问题吗?
可能是什么问题?几个月前 - 一切正常,该项目没有被触及(已存档) 先谢谢你了
UPD:与证书无关,这是SAP,他们自己更新
我不确定这里是否有足够的信息来准确诊断您的问题,但该错误表明 SSL 握手错误,对我来说,通常表明问题不在代码中,而是在证书/可接受的加密中通信通道的算法。
Retrofit 是一个 REST 框架,所以我假设您在它之上编写了一个 API,并且 Retrofit 处理您的 HTTP 会话和 SSL 内容。你说解决方案突然停止工作。您的改造依赖项是最新的吗?也许可以更新您的依赖项,重新打包您的应用程序,看看是否有效?