sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
解决方法:
报错的写法:URL realUrl = new URL(url);
不报错写法:URL realUrl= new URL(null, url, new sun.net.www.protocol.https.Handler());
HttpsURLConnection conn = (HttpsURLConnection) realUrl.openConnection();