CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.add(new EntityIDCriteria(context.getPeerEntityId()));
criteriaSet.add(new MetadataCriteria(IDPSSODescriptor.DEFAULT_ELEMENT_NAME, SAMLConstants.SAML20P_NS));
criteriaSet.add(new UsageCriteria(UsageType.UNSPECIFIED));
X509TrustManager trustManager = new X509TrustManager(criteriaSet, context.getLocalSSLTrustEngine());
X509KeyManager manager = new X509KeyManager(context.getLocalSSLCredential());
HostnameVerifier hostnameVerifier = context.getLocalSSLHostnameVerifier();
ProtocolSocketFactory socketFactory = getSSLSocketFactory(context, manager, trustManager, hostnameVerifier);
Protocol protocol = new Protocol("https", socketFactory, 443);