private static Platform findPlatform(){
  Class<?> openSslSocketClass;
  Method setUseSessionTickets;
  Method setHostname;
  try {
    try {
      openSslSocketClass=Class.forName("com.android.org.conscrypt.OpenSSLSocketImpl");
    }
 catch (    ClassNotFoundException ignored) {
      openSslSocketClass=Class.forName("org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl");
    }
    setUseSessionTickets=openSslSocketClass.getMethod("setUseSessionTickets",boolean.class);
    setHostname=openSslSocketClass.getMethod("setHostname",String.class);
    try {
      Method setNpnProtocols=openSslSocketClass.getMethod("setNpnProtocols",byte[].class);
      Method getNpnSelectedProtocol=openSslSocketClass.getMethod("getNpnSelectedProtocol");
      return new Android41(openSslSocketClass,setUseSessionTickets,setHostname,setNpnProtocols,getNpnSelectedProtocol);
    }
 catch (    NoSuchMethodException ignored) {
      return new Android23(openSslSocketClass,setUseSessionTickets,setHostname);
    }
  }
 catch (  ClassNotFoundException ignored) {
  }
catch (  NoSuchMethodException ignored) {
  }
  try {
    String npnClassName="org.eclipse.jetty.npn.NextProtoNego";
    Class<?> nextProtoNegoClass=Class.forName(npnClassName);
    Class<?> providerClass=Class.forName(npnClassName + "$Provider");
    Class<?> clientProviderClass=Class.forName(npnClassName + "$ClientProvider");
    Class<?> serverProviderClass=Class.forName(npnClassName + "$ServerProvider");
    Method putMethod=nextProtoNegoClass.getMethod("put",SSLSocket.class,providerClass);
    Method getMethod=nextProtoNegoClass.getMethod("get",SSLSocket.class);
    return new JdkWithJettyNpnPlatform(putMethod,getMethod,clientProviderClass,serverProviderClass);
  }
 catch (  ClassNotFoundException ignored) {
  }
catch (  NoSuchMethodException ignored) {
  }
  return new Platform();
}

private static Platform findPlatform ( ) { Class < ? > openSslSocketClass ; Method setUseSessionTickets ; Method setHostname ; try { try { openSslSocketClass = Class . forName ( "com.android.org.conscrypt.OpenSSLSocketImpl" ) ; } catch ( ClassNotFoundException ignored ) { openSslSocketClass = Class . forName ( "org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl" ) ; } setUseSessionTickets = openSslSocketClass . getMethod ( "setUseSessionTickets" , boolean . class ) ; setHostname = openSslSocketClass . getMethod ( "setHostname" , String . class ) ; try { Method setNpnProtocols = openSslSocketClass . getMethod ( "setNpnProtocols" , byte [ ] . class ) ; Method getNpnSelectedProtocol = openSslSocketClass . getMethod ( "getNpnSelectedProtocol" ) ; return new Android41 ( openSslSocketClass , setUseSessionTickets , setHostname , setNpnProtocols , getNpnSelectedProtocol ) ; } catch ( NoSuchMethodException ignored ) { return new Android23 ( openSslSocketClass , setUseSessionTickets , setHostname ) ; } } catch ( ClassNotFoundException ignored ) { } catch ( NoSuchMethodException ignored ) { } try { String npnClassName = "org.eclipse.jetty.npn.NextProtoNego" ; Class < ? > nextProtoNegoClass = Class . forName ( npnClassName ) ; Class < ? > providerClass = Class . forName ( npnClassName + "$Provider" ) ; Class < ? > clientProviderClass = Class . forName ( npnClassName + "$ClientProvider" ) ; Class < ? > serverProviderClass = Class . forName ( npnClassName + "$ServerProvider" ) ; Method putMethod = nextProtoNegoClass . getMethod ( "put" , SSLSocket . class , providerClass ) ; Method getMethod = nextProtoNegoClass . getMethod ( "get" , SSLSocket . class ) ; return new JdkWithJettyNpnPlatform ( putMethod , getMethod , clientProviderClass , serverProviderClass ) ; } catch ( ClassNotFoundException ignored ) { } catch ( NoSuchMethodException ignored ) { } return new Platform ( ) ; }
attempt to match the host runtime to a capable platform implementation .
