robovm icon indicating copy to clipboard operation
robovm copied to clipboard

OkHttp throws SSLProtocolException: SSL handshake aborted

Open MrStahlfelge opened this issue 2 years ago • 2 comments

Issue details

OkHttp throws an SSLProtocolException, see stacktrace. Interesting is: It works with OkHttp 3.12.0, but crashes with 3.12.13

Reproduction steps/code

build.gradle:

    implementation("com.squareup.okhttp3:okhttp:3.12.13")
    implementation("com.squareup.okhttp3:okhttp-urlconnection:3.12.13")
            OkHttpClient client = new OkHttpClient();
            Request request = new Request.Builder()
                    .url("https://api-testnet.ergoplatform.com/")
                    .build();

            try (Response response = client.newCall(request).execute()) {
                response.body().string();
            } catch (IOException e) {
                e.printStackTrace();
            }

Configuration

Please provide the build system, version(s), and targets affected.

Build Tools:

  • [X] IDEA plugin
  • [X] Gradle plugin

Versions:

Please provide the version of RoboVM, XCode and JDK used

  • Robovm: 2.3.12
  • XCode:
  • JDK:8

Build Targets:

iPhone 8 Simulator


Stacktrace

javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7fc034b34080: Failure in SSL library, usually a protocol error
error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/Projects/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x10b2c4261:0x00000000)
	at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
	at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405)

MrStahlfelge avatar Oct 07 '21 19:10 MrStahlfelge

hi, in 3.12.9 they returned check for Build class to match simple android case. So a workaround is to add one as described here https://dkimitsa.github.io/2018/09/11/robovm-and-okhttp3-3-11-0/

dkimitsa avatar Oct 20 '21 08:10 dkimitsa

Thanks, I will check if that helps

MrStahlfelge avatar Oct 20 '21 09:10 MrStahlfelge