创建SSL上下文
import java.net.URL;// 来 自 时 代 J a v a - nowjava.com import java.security.GeneralSecurityException; import java.security.SecureRandom; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.X509TrustManager; public class Main{ public static void main(String[] argv) throws Exception{ System.out.println(createSSLContext()); } public static SSLContext createSSLContext() throws GeneralSecurityException { SSLContext context = SSLContext.getInstance("TLS"); /* 来自 *N o w J a v a . c o m*/ context.init( null,