Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OKHttp - Can't find setSslSocketFactory

Tags:

android

okhttp

I'm using OkHttp 3.4.0-RC1. I'm trying to write a web service that connects an Android 4.2.2 / API 17 device via TLSv1.2. I saw the answer at the bottom of this post Android Enable TLSv1.2 in OKHttp but apparently the method setSslSocketFactory is no longer present. I also did not see anything in the Https doc on OKHttp. Thanks!

like image 856
Flatpick13 Avatar asked Feb 23 '26 21:02

Flatpick13


1 Answers

The SslSocketFactory is now configured on the OkHttpClient.Builder

client = new OkHttpClient.Builder()
    .sslSocketFactory(sslSocketFactory, trustManager)
    .build();

https://github.com/square/okhttp/blob/3f7a3344a4c85aa3bbb879dabac5ee625ab987f3/samples/guide/src/main/java/okhttp3/recipes/CustomTrust.java#L54

like image 88
Yuri Schimke Avatar answered Feb 25 '26 10:02

Yuri Schimke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!