访问https时,需要验证ssl证书,使用HttpsURLConnection访问一个我们已经信任的https页面,需要跳过crt验证时,可以参考如下代码
public static void main(String argv[]){
String urlStr = "https://github.com/Unknwon/go-fundamental-programming";
try {
URL url = new URL(urlStr);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
TrustManager[] trustManagers = new TrustManager[]{
new X509TrustManager() {
public void