简体   繁体   中英

Using HostnameVerifier in Mobilefirst 7.1 Java Adapter

I got some code from a very helpful Stackoverflow contributor (Michal Foska), and I am having some issues implementing it in a Mobilefirst Adapter. It seems that Mobilefirst picks up the wrong SSLConnectionSocketFactory class which does not have the same constructor as below.

It appears to only allow a X509HostnameVerifier. Any ideas?

SSLConnectionSocketFactory sslCF = new SSLConnectionSocketFactory(context, new HostnameVerifier() {
@Override
 public boolean verify(String hostname, SSLSession session) {
 // or add your own test here
    return true;
 }});

From the comments:

Tim: I resolved it by having the certificate fixed.....but never found out how to get the Hostname Verifier to work in adapter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM