package com.palacesun.engine.common;

import org.chenyang.http.conn.ssl.NoopHostnameVerifier;
import org.chenyang.http.conn.ssl.SSLConnectionSocketFactory;
import org.chenyang.http.impl.client.CloseableHttpClient;
import org.chenyang.http.impl.client.HttpClients;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

class SkipHttpsUtil {
   public static CloseableHttpClient wrapClient() {
      try {
         SSLContext ctx = SSLContext.getInstance("TLS");
         X509TrustManager tm = new X509TrustManager() {
            public X509Certificate[] getAcceptedIssuers() {
               return null;
            }

            public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
            }

            public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
            }
         };
         ctx.init((KeyManager[])null, new TrustManager[]{tm}, (SecureRandom)null);
         SSLConnectionSocketFactory ssf = new SSLConnectionSocketFactory(ctx, NoopHostnameVerifier.INSTANCE);
         CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(ssf).build();
         return httpclient;
      } catch (Exception var4) {
         return HttpClients.createDefault();
      }
   }

   public static void main(String[] args) {
      System.out.println("插件http请求类：" + SSLConnectionSocketFactory.class.getPackage().getImplementationVersion());
      System.out.println("插件http请求类：" + SSLConnectionSocketFactory.class.getProtectionDomain().getCodeSource());
   }
}
