Commit a6bc5e3069a03ef6af6c2e19b770f6e9a4399e33
1 parent
f2ac3c9e
m
Showing
1 changed file
with
14 additions
and
12 deletions
trash-common/src/main/java/com/trash/common/utils/RemoteServerUtils.java
| @@ -726,19 +726,21 @@ public class RemoteServerUtils { | @@ -726,19 +726,21 @@ public class RemoteServerUtils { | ||
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | public static OkHttpClient getOkClient() { | 728 | public static OkHttpClient getOkClient() { |
| 729 | - X509TrustManager x509TrustManager = null; | ||
| 730 | - try { | ||
| 731 | - File file = new File("src/main/resources/183.66.242.6.crt"); | ||
| 732 | - x509TrustManager = trustManagerForCertificates(new FileInputStream(file)); | ||
| 733 | - } catch (FileNotFoundException e) { | ||
| 734 | - // TODO Auto-generated catch block | ||
| 735 | - e.printStackTrace(); | ||
| 736 | - } catch (GeneralSecurityException e) { | ||
| 737 | - // TODO Auto-generated catch blockxiashuo | ||
| 738 | - e.printStackTrace(); | ||
| 739 | - } | 729 | +// X509TrustManager x509TrustManager = null; |
| 730 | +// try { | ||
| 731 | +// File file = new File("src/main/resources/183.66.242.6.crt"); | ||
| 732 | +// x509TrustManager = trustManagerForCertificates(new FileInputStream(file)); | ||
| 733 | +// } catch (FileNotFoundException e) { | ||
| 734 | +// // TODO Auto-generated catch block | ||
| 735 | +// e.printStackTrace(); | ||
| 736 | +// } catch (GeneralSecurityException e) { | ||
| 737 | +// // TODO Auto-generated catch blockxiashuo | ||
| 738 | +// e.printStackTrace(); | ||
| 739 | +// } | ||
| 740 | + | ||
| 741 | +// .sslSocketFactory(createSSLSocketFactory(), x509TrustManager) | ||
| 740 | 742 | ||
| 741 | - okHttpClient = new OkHttpClient.Builder().sslSocketFactory(createSSLSocketFactory(), x509TrustManager) | 743 | + okHttpClient = new OkHttpClient.Builder() |
| 742 | .connectTimeout(20, TimeUnit.SECONDS).writeTimeout(20, TimeUnit.SECONDS) | 744 | .connectTimeout(20, TimeUnit.SECONDS).writeTimeout(20, TimeUnit.SECONDS) |
| 743 | .readTimeout(30, TimeUnit.SECONDS).build(); | 745 | .readTimeout(30, TimeUnit.SECONDS).build(); |
| 744 | 746 |