getActivity / EasyHttp

Android 网络请求框架,简单易用,so easy
Apache License 2.0
1.4k stars 191 forks source link

[疑惑]:看文档介绍该框架是支持Android API 14及以上即可,我的设备是API 19的(Android4.4.2),但是使用此框架访问接口报了这个错误 #242

Closed zhang3776813 closed 6 months ago

zhang3776813 commented 6 months ago

问题描述【必填】

看文档介绍该框架是支持Android API 14及以上即可,我的设备是API 19的(Android4.4.2),但是使用此框架访问接口报了这个错误,查看文档没有找到解决办法,忘大佬看看,以下是报错内容: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x58ca4428: Failure in SSL library, usually a protocol error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x56e92cd4:0x00000000) javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x58ca4428: Failure in SSL library, usually a protocol error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x56e92cd4:0x00000000) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:448) at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:320) at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:284) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:169) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:258) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:127) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:201) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 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=0x58ca4428: Failure in SSL library, usually a protocol error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x56e92cd4:0x00000000) at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) ... 23 more

框架文档是否提及了该问题【必答】

是否已经查阅框架文档但还未能解决的【必答】

issue 列表中是否有人曾提过类似的问题【必答】

是否已经搜索过了 issue 列表但还未能解决的【必答】

getActivity commented 6 months ago
image
getActivity commented 6 months ago

小伙子,根据你提供的描述,经过 Demo 工程测试验证,无法复现该问题。

getActivity commented 6 months ago

@zhang3776813 另外请确认这个是否为 EasyHttp 导致的,如果是 OkHttp 导致的,请到 OkHttp 的 Github 进行提 issue 反馈,如果是你和后台的问题,请自行排查和解决。

zhang3776813 commented 6 months ago

已经确认了是OkHttp导致的,需要重写SSLSocketFactory,设置打开tvs1.1 、tls1.2的支持,这片文章介绍的:https://blog.csdn.net/u010393836/article/details/112969042

zhang3776813 commented 6 months ago

@getActivity 感谢老哥回复,我的问题已经解决