Модифицированный HTTP СБОЙ: javax.net.ssl.SSLHandshakeException - PullRequest
0 голосов
/ 02 сентября 2018

Я использую Retrofit для работы в сети в моем приложении. Приложение прекрасно работает на устройствах с версией os больше 4.4, но выдает исключение javax.net.ssl.SSLHandshakeException в эмуляторе с версией os 4.4 (API 19). Вот моя модификация конфигурации

    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(HttpLoggingInterceptor.Level.BODY);
    final OkHttpClient okHttpClient = new OkHttpClient.Builder()
                .readTimeout(180, TimeUnit.SECONDS)
                .connectTimeout(180, TimeUnit.SECONDS)
                .addInterceptor(logging)
                .build();

    final Retrofit retrofit = new Retrofit.Builder().baseUrl(BuildConfig.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .client(okHttpClient)
            .build();

    mListener = retrofit.create(ApiListener.class);

Вот мой журнал исключений

D/OkHttp: <-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8c1d320: 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 0x8d9bf990:0x00000000)

Я добавил spce соединения с версией TLS TLS_1_2. И теперь я получаю java.net.UnknownServiceException: Unable to find acceptable protocols.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...