Search in sources :

Example 1 with NaiveTrustManager

use of com.wavefront.agent.tls.NaiveTrustManager in project java by wavefrontHQ.

the class PushAgentTest method init.

@BeforeClass
public static void init() throws Exception {
    TrustManager[] tm = new TrustManager[] { new NaiveTrustManager() };
    SSLContext context = SSLContext.getInstance("SSL");
    context.init(new KeyManager[0], tm, new SecureRandom());
    sslSocketFactory = context.getSocketFactory();
    HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
    HttpsURLConnection.setDefaultHostnameVerifier((h, s) -> h.equals("localhost"));
}
Also used : NaiveTrustManager(com.wavefront.agent.tls.NaiveTrustManager) SecureRandom(java.security.SecureRandom) SSLContext(javax.net.ssl.SSLContext) TrustManager(javax.net.ssl.TrustManager) NaiveTrustManager(com.wavefront.agent.tls.NaiveTrustManager) BeforeClass(org.junit.BeforeClass)

Aggregations

NaiveTrustManager (com.wavefront.agent.tls.NaiveTrustManager)1 SecureRandom (java.security.SecureRandom)1 SSLContext (javax.net.ssl.SSLContext)1 TrustManager (javax.net.ssl.TrustManager)1 BeforeClass (org.junit.BeforeClass)1