@@ -67,10 +67,6 @@ public class WxMpServiceImpl implements WxMpService {
6767
6868 private HttpHost httpProxy ;
6969
70- public HttpHost getHttpProxy () {
71- return this .httpProxy ;
72- }
73-
7470 private int retrySleepMillis = 1000 ;
7571
7672 private int maxRetryTimes = 5 ;
@@ -421,6 +417,10 @@ protected synchronized <T, E> T executeInternal(RequestExecutor<T, E> executor,
421417 throw new RuntimeException (e );
422418 }
423419 }
420+
421+ public HttpHost getHttpProxy () {
422+ return this .httpProxy ;
423+ }
424424
425425 public CloseableHttpClient getHttpclient () {
426426 return this .httpClient ;
@@ -429,19 +429,23 @@ public CloseableHttpClient getHttpclient() {
429429 @ Override
430430 public void setWxMpConfigStorage (WxMpConfigStorage wxConfigProvider ) {
431431 this .wxMpConfigStorage = wxConfigProvider ;
432+ this .initHttpClient ();
433+ }
432434
435+ private void initHttpClient () {
433436 ApacheHttpClientBuilder apacheHttpClientBuilder = this .wxMpConfigStorage .getApacheHttpClientBuilder ();
434437 if (null == apacheHttpClientBuilder ) {
435438 apacheHttpClientBuilder = DefaultApacheHttpHttpClientBuilder .get ();
436439 }
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 ());
441445
442- if (wxConfigProvider .getSSLContext () != null ){
446+ if (this . wxMpConfigStorage .getSSLContext () != null ){
443447 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory (
444- wxConfigProvider .getSSLContext (),
448+ this . wxMpConfigStorage .getSSLContext (),
445449 new String [] { "TLSv1" },
446450 null ,
447451 SSLConnectionSocketFactory .BROWSER_COMPATIBLE_HOSTNAME_VERIFIER );
0 commit comments