|
|
@@ -2,9 +2,8 @@ package com.genersoft.iot.vmp.media.zlm;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
-import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
|
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
|
|
-import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
|
|
+import com.genersoft.iot.vmp.utils.SSLSocketClientUtil;
|
|
|
import okhttp3.*;
|
|
|
import okhttp3.logging.HttpLoggingInterceptor;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
@@ -13,11 +12,10 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
+import javax.net.ssl.X509TrustManager;
|
|
|
import java.io.IOException;
|
|
|
import java.net.ConnectException;
|
|
|
-import java.net.MalformedURLException;
|
|
|
import java.net.SocketTimeoutException;
|
|
|
-import java.net.URL;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -61,6 +59,10 @@ public class AssistRESTfulUtils {
|
|
|
// OkHttp進行添加攔截器loggingInterceptor
|
|
|
httpClientBuilder.addInterceptor(logging);
|
|
|
}
|
|
|
+ X509TrustManager manager = SSLSocketClientUtil.getX509TrustManager();
|
|
|
+ // 设置ssl
|
|
|
+ httpClientBuilder.sslSocketFactory(SSLSocketClientUtil.getSocketFactory(manager), manager);
|
|
|
+ httpClientBuilder.hostnameVerifier(SSLSocketClientUtil.getHostnameVerifier());//忽略校验
|
|
|
client = httpClientBuilder.build();
|
|
|
}
|
|
|
return client;
|