I am using Retrofit 1.9 with OKHTTP3 client and I am trying to add certification pinning. Below is the relevant code:
String hostname = "xxxxxx.xx";
CertificatePinner certificatePinner = new CertificatePinner.Builder()
    .add(hostname, "sha1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=")
    .build();
OkHttpClient client = new OkHttpClient.Builder()
     .certificatePinner(certificatePinner)
     .build();
return new RestAdapter.Builder()
     .setRequestInterceptor(request -> {
         request.addHeader("CONTENT-TYPE", "application/json");
     })
     .setEndpoint("https://xxxxxxxxxxxx").
     .setClient(new Ok3Client(client))
     .build();
Unfortunately it doesn't seem to be working. I don't have the
"javax.net.ssl.SSLPeerUnverifiedException: Certificate pinning failure!"
exception and even my host or SHA is incorrect. Can anyone explain why?