发送请求是跳过证书
package com.yurun.micro.common.third.ding; import okhttp3.OkHttpClient; import javax.net.ssl.*; /** * okhttp ssl证书解决 * @author dll * @create 2020-05-26 */ public class OkHttpSSL { public static OkHttpClient getUnsafeOkHttpClient() { try { final TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @Override public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) { } @Override public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) { } @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[]{}; } } }; final SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); final javax.net.ssl.SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.sslSocketFactory(sslSocketFactory); builder.hostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }); return builder.build(); } catch (Exception e) { throw new RuntimeException(e); } } }
之后使用第三方jar时候又出现了了这个ssl问题 。切换了好几个版本号机缘巧合解决了问题,并没有解决实质性问题
后来同事买了新电脑,发现没有这个问题。。。下定决心重装系统。。。完美解决了ssl证书问题和idea启动开2个小时左右,cpu飙升问题。。。。