Skip to content

Instantly share code, notes, and snippets.

View kenrube's full-sized avatar

Ivan Zolotarev kenrube

View GitHub Profile
@kenrube
kenrube / ApiBuilder.java
Last active November 17, 2022 05:13
Self-signed server certificate with Retrofit 2.0
// see http://developer.android.com/intl/ru/training/articles/security-ssl.html#UnknownCa
// copy ssl certificate: echo -n | openssl s_client -connect server:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ./res/raw/cert.crt
public class ApiBuilder {
public static IServerApi getServerApi() {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
try {
Context context = App.getContext();