Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Support with custom host #325

Open
moeindev opened this issue Mar 12, 2019 · 1 comment
Open

SSL Support with custom host #325

moeindev opened this issue Mar 12, 2019 · 1 comment

Comments

@moeindev
Copy link

Hi, thank you for this amazing library.

I was wondering if this library supports custom SSL connection to observe internet connectivity!

when I want to check the connection with the base URL, https://bluhbluh.bluh
it gives me the handshake error...

javax.net.ssl.SSLHandshakeException: Handshake failed

for calling my web APIs, Im using retrofit and custom SSL configuration
inline fun <reified T> createWebService(): T { val customTrust = CustomTrust() var client = OkHttpClient.Builder().build() try { client = OkHttpClient.Builder() .sslSocketFactory(customTrust.getSocketFactory(),customTrust.getTrustManager()) .build() Log.i("Security","Ssl initialized") }catch (e: GeneralSecurityException){ Log.e("Security","unable to init ssl") } val gson = GsonBuilder() .setLenient() .create() val retrofit = Retrofit.Builder() .baseUrl(baseUrl) .client(client) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build() return retrofit.create(T::class.java) }

@pwittchen
Copy link
Owner

It's not explicitly supported now and I haven't tested it for such cases. Nevertheless, I'm open for improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants