@@ -67,10 +67,6 @@ public class WxMpServiceImpl implements WxMpService {
67
67
68
68
private HttpHost httpProxy ;
69
69
70
- public HttpHost getHttpProxy () {
71
- return this .httpProxy ;
72
- }
73
-
74
70
private int retrySleepMillis = 1000 ;
75
71
76
72
private int maxRetryTimes = 5 ;
@@ -421,6 +417,10 @@ protected synchronized <T, E> T executeInternal(RequestExecutor<T, E> executor,
421
417
throw new RuntimeException (e );
422
418
}
423
419
}
420
+
421
+ public HttpHost getHttpProxy () {
422
+ return this .httpProxy ;
423
+ }
424
424
425
425
public CloseableHttpClient getHttpclient () {
426
426
return this .httpClient ;
@@ -429,19 +429,23 @@ public CloseableHttpClient getHttpclient() {
429
429
@ Override
430
430
public void setWxMpConfigStorage (WxMpConfigStorage wxConfigProvider ) {
431
431
this .wxMpConfigStorage = wxConfigProvider ;
432
+ this .initHttpClient ();
433
+ }
432
434
435
+ private void initHttpClient () {
433
436
ApacheHttpClientBuilder apacheHttpClientBuilder = this .wxMpConfigStorage .getApacheHttpClientBuilder ();
434
437
if (null == apacheHttpClientBuilder ) {
435
438
apacheHttpClientBuilder = DefaultApacheHttpHttpClientBuilder .get ();
436
439
}
437
- apacheHttpClientBuilder .httpProxyHost (this .wxMpConfigStorage .getHttp_proxy_host ())
438
- .httpProxyPort (this .wxMpConfigStorage .getHttp_proxy_port ())
439
- .httpProxyUsername (this .wxMpConfigStorage .getHttp_proxy_username ())
440
- .httpProxyPassword (this .wxMpConfigStorage .getHttp_proxy_password ());
440
+
441
+ apacheHttpClientBuilder .httpProxyHost (this .wxMpConfigStorage .getHttpProxyHost ())
442
+ .httpProxyPort (this .wxMpConfigStorage .getHttpProxyPort ())
443
+ .httpProxyUsername (this .wxMpConfigStorage .getHttpProxyUsername ())
444
+ .httpProxyPassword (this .wxMpConfigStorage .getHttpProxyPassword ());
441
445
442
- if (wxConfigProvider .getSSLContext () != null ){
446
+ if (this . wxMpConfigStorage .getSSLContext () != null ){
443
447
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory (
444
- wxConfigProvider .getSSLContext (),
448
+ this . wxMpConfigStorage .getSSLContext (),
445
449
new String [] { "TLSv1" },
446
450
null ,
447
451
SSLConnectionSocketFactory .BROWSER_COMPATIBLE_HOSTNAME_VERIFIER );
0 commit comments