1
0
mirror of synced 2025-12-20 07:38:27 +08:00

#293 重构OkHttp的实现代码,同时修复JSApi的bug

* update travis settings

* feat(okhttp): 修改okhttp底层调用方法

直接用OkHttpClient代替connect.使客户端单一化.Okhttp 自动管理连接池优化

* feat(log,jsApi): 添加log debug 标记明确下调用底层效果,修复jsAPI Lock 为null 问题

添加log debug 标记明确下调用底层效果,修复jsAPI Lock 为null 问题

#293
This commit is contained in:
dylanleung
2017-07-30 22:39:20 -05:00
committed by Binary Wang
parent 945516515c
commit 0a06c4d1a1
17 changed files with 159 additions and 280 deletions

View File

@@ -29,4 +29,10 @@ public class WxMpBaseAPITest {
Assert.assertTrue(StringUtils.isNotBlank(after));
}
public void testJsapiTicket() throws WxErrorException {
String jsapiTicket = this.wxService.getJsapiTicket(false);
System.out.println(jsapiTicket);
Assert.assertNotNull(jsapiTicket);
}
}

View File

@@ -20,11 +20,7 @@ public class WxMpJsAPITest {
protected WxMpService wxService;
public void testJsapiTicket() throws WxErrorException {
String jsapiTicket = this.wxService.getJsapiTicket(false);
System.out.println(jsapiTicket);
Assert.assertNotNull(jsapiTicket);
}
public void test() {
long timestamp = 1419835025l;

View File

@@ -7,6 +7,7 @@ import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceApacheHttpClientImpl;
import me.chanjar.weixin.mp.api.impl.WxMpServiceOkHttpImpl;
import java.io.IOException;
import java.io.InputStream;
@@ -19,7 +20,7 @@ public class ApiTestModule implements Module {
try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) {
TestConfigStorage config = this.fromXml(TestConfigStorage.class, is1);
config.setAccessTokenLock(new ReentrantLock());
WxMpService wxService = new WxMpServiceApacheHttpClientImpl();
WxMpService wxService = new WxMpServiceOkHttpImpl();
wxService.setWxMpConfigStorage(config);
binder.bind(WxMpService.class).toInstance(wxService);