gpt4 book ai didi

java - 31 个客户端之一的 Appengine Endpoints Android 客户端中的 SSLProtocolException

转载 作者:行者123 更新时间:2023-11-30 01:58:32 27 4
gpt4 key购买 nike

我使用生成的应用引擎 Android 客户端 (jar lib)。 31 个客户端中有 30 个没有问题。但是一台三星平板电脑拒绝连接并出现崩溃:

Android: 4.4.4 Manufacturer: samsung Model: SM-T533 - Date: Mon Aug 03 09:49:03 CEST 2015

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x743164d0: Failure in SSL library, usually a protocol error error:1407743E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert inappropriate fallback (external/openssl/ssl/s23_clnt.c:744 0x74509f1c:0x00000000) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:449) at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) at com.android.okhttp.Connection.connect(Connection.java:107) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503) at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136) at com.google.api.client.http.javanet.NetHttpResponse.(NetHttpResponse.java:37) at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:972) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) at nl.stackoverflow.question.RestoreDataLoader.loadInBackground(RestoreDataLoader.java:37) at nl.stackoverflow.question.RestoreDataLoader.loadInBackground(RestoreDataLoader.java:20) at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:312) at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:69) at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:57) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x743164d0: Failure in SSL library, usually a protocol error error:1407743E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert inappropriate fallback (external/openssl/ssl/s23_clnt.c:744 0x74509f1c:0x00000000) at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:406) ... 25 more

ApiUtils 类:

/**
* Sales API Utility functions
*
* Created by Roel de Brouwer on 29-4-2015.
*/
public class ApiUtils {

public static final String APP_NAME = BuildConfig.APP_NAME;
public static final String WEB_CLIENT_ID = BuildConfig.WEBCLIENT_ID;
public static final String AUDIENCE = "server:client_id:" + WEB_CLIENT_ID;
/**
* Class instance of the HTTP transport.
*/
public static final HttpTransport HTTP_TRANSPORT = AndroidHttp.newCompatibleTransport();
/**
* Class instance of the JSON factory.
*/
public static final JsonFactory JSON_FACTORY = new AndroidJsonFactory();

private Context mContext;
private String mAccountName;

public ApiUtils(Context context, String accountName){
this.mContext = context;
this.mAccountName = accountName;
}


private GoogleAccountCredential getCredential(){
GoogleAccountCredential credential = GoogleAccountCredential.usingAudience(mContext, AUDIENCE);
credential.setSelectedAccountName(mAccountName);
return credential;
}


/**
* Retrieve a Sales api service handle to access the API.
*/
public Sales getApiServiceHandle() {
// Use a builder to help formulate the API request.
Sales.Builder salesAPI = new Sales.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredential());
Log.d("RootURL", salesAPI.getRootUrl());
salesAPI.setApplicationName(APP_NAME);
return salesAPI.build();
}

/**
* @return Sales Api
*/
public Sales.SalesAPI getApi(){
return getApiServiceHandle().salesAPI();
}
}

最佳答案

将平板电脑更新到最新的操作系统版本(被三星削弱)解决了这个问题。 (仍然基于Android 4.4.4)

关于java - 31 个客户端之一的 Appengine Endpoints Android 客户端中的 SSLProtocolException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31827908/

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