��ȡ����������
()
| 287 | * ��ȡ���������� |
| 288 | */ |
| 289 | private static void getTrust() { |
| 290 | try { |
| 291 | HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { |
| 292 | |
| 293 | public boolean verify(String hostname, SSLSession session) { |
| 294 | return true; |
| 295 | } |
| 296 | }); |
| 297 | SSLContext context = SSLContext.getInstance("TLS"); |
| 298 | context.init(null, new X509TrustManager[] { new X509TrustManager() { |
| 299 | |
| 300 | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} |
| 301 | |
| 302 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} |
| 303 | |
| 304 | public X509Certificate[] getAcceptedIssuers() { |
| 305 | return new X509Certificate[0]; |
| 306 | } |
| 307 | } }, new SecureRandom()); |
| 308 | HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory()); |
| 309 | } catch (Exception e) { |
| 310 | e.printStackTrace(); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | } |
no outgoing calls
no test coverage detected