要使用TLSv1.2,请尝试使用以下代码:
SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, null, null);