gpt4 book ai didi

java - D/OkHttp : <-- HTTP FAILED: javax.net.ssl.SSLException : SSL handshake aborted: ssl=0x64e3c938: I/O error during system call, 连接被对端重置

转载 作者:行者123 更新时间:2023-11-29 23:25:13 24 4
gpt4 key购买 nike

<分区>

D/OkHttp: <-- HTTP FAILED: javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x64e3c938: I/O error during system call, Connection reset by peer

我在 Android 4.2.2 设备上遇到此错误。在其他设备上运行相同的应用程序时,它工作正常。请帮忙。

public static Retrofit getClient(final Context context, final Server newServer) {
if(retrofit == null || server == null || !getServer().equals(newServer) || tok != null) {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder okHttpClient = new OkHttpClient()
.newBuilder().addInterceptor(loggingInterceptor);

okHttpClient.addInterceptor( new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
String hh=tok.replace("\"", ""); //For removing the " from the token
Request newRequest = chain
.request()
.newBuilder()
.addHeader(HTTP_AUTH_HEADER,"Bearer " + hh) //token use for the Authentication.
.build();
return chain.proceed(newRequest);
}
});


retrofit = new Retrofit.Builder()
.baseUrl(getBaseUrl(context, server))
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient.build())
.build();
}
return retrofit;
}
private static String getBaseUrl(Context context, Server newServer) {
StringBuilder builder = new StringBuilder();
server = newServer; // update server address
if(server != null && server.getAddress() != null) {
return builder.append(server.getAddress()).toString();
} else { // set default address
return builder.append(BuildConfig.SERVER_ADDRESS).toString();
}
}
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com