0

I have this error: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8af1e68: Failure in SSL library, usually a protocol error error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x96f99926:0x00000000)

1 Answers1

0

This work! here my solved code for socket.io 1.0.0:

OkHttpClient.Builder httpClient = new OkHttpClient.Builder();

            HttpLoggingInterceptor logging = new HttpLoggingInterceptor(
                    new HttpLoggingInterceptor.Logger() {
                        @Override
                        public void log(String message) {
                            Platform.get().log(Platform.WARN, "Log Util: " + message, null);
                        }
                    }).setLevel(HttpLoggingInterceptor.Level.BODY);

            httpClient.addInterceptor(logging);
                ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
                        .tlsVersions(TlsVersion.TLS_1_0)
                        .allEnabledCipherSuites()
                        .build();
                httpClient.connectionSpecs(Collections.singletonList(spec));

            OkHttpClient client = httpClient.build();

            IO.setDefaultOkHttpWebSocketFactory(client);
            IO.setDefaultOkHttpCallFactory(client);

// set as an option
            IO.Options opts = new IO.Options();
            opts.callFactory = client;
            opts.webSocketFactory = client;

            socket = IO.socket(Constants.HOST, opts);