TLSv1 is not enabled or not supported by the client
Asked Answered
P

2

6

i use okhttp to send request to server but i got the error

Server chose TLSv1, but that protocol version is not enabled or not supported by the client.
javax.net.ssl.SSLHandshakeException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.
    at sun.security.ssl.ClientHandshaker.serverHello(ClientHandshaker.java:452)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:206)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:961)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:336)
    at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:300)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:185)
    at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
    at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
    at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)

But i send request more time, it works. I don't know why. Please help me!

Parang answered 15/1, 2020 at 2:43 Comment(3)
See this answer on how to set the TLS version: https://mcmap.net/q/35844/-android-enable-tlsv1-2-in-okhttpBrockway
i did it but sometimes in first request i got that error and i send request again it worksParang
Can you add the code which you use to send the request? Is the server under your control (eg do you know how it is configured)?Agnesse
A
1

OkHttp remembers which routes have failed previously and tries other routes instead when making new connections. It's possible your server is reachable via multiple routes.

Typically this is due to multiple IP addresses, but it could also be due to multiple client-side proxies.

If different routes have different TLS settings that could cause this behavior.

Atheist answered 15/1, 2020 at 4:29 Comment(1)
oh i think be due to multiple client-side proxies. But you can suggest me how to log router is used in okhttp?Parang
F
0

Check your Java versions, if they were updated recently or there is a mismatch between servers, the error will show as this.

Run these to check the culprit:

sudo java -version

//to check for updates
sudo yum history list
sudo yum history info ID_SUSPECTED_ON_LIST

Just wanted to post another answer I didn't see mentioned that turned out to be the problem on my system.

Formaldehyde answered 28/7, 2021 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.