use of com.rabbitmq.client.TrustEverythingTrustManager in project rabbitmq-java-client by rabbitmq.
the class SslContextFactoryTest method sslContextFactory.
private SslContextFactory sslContextFactory() throws Exception {
SSLContext contextAcceptAll = SSLContext.getInstance(tlsProtocol());
contextAcceptAll.init(null, new TrustManager[] { new TrustEverythingTrustManager() }, null);
SSLContext contextRejectAll = SSLContext.getInstance(tlsProtocol());
contextRejectAll.init(null, new TrustManager[] { new TrustNothingTrustManager() }, null);
Map<String, SSLContext> sslContexts = new HashMap<>();
sslContexts.put("connection01", contextAcceptAll);
sslContexts.put("connection02", contextRejectAll);
SslContextFactory sslContextFactory = name -> sslContexts.get(name);
return sslContextFactory;
}
Aggregations