<dependency>
<groupId>me.gaigeshen.wechat</groupId>
<artifactId>wechat-pay</artifactId>
<version>${VERSION}</version>
</dependency>
Config config = Config.builder()
.appid("your appid")
.mchId("your mchId")
.key("your key")
.secret("your secret")
.build();
InputStream in = ...;
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(in, "your password".toCharArray());
SSLContext sslContext = SSLContextBuilder.create().loadKeyMaterial(keyStore, "your password".toCharArray()
HttpClientExecutor httpClient = new HttpClientExecutor(2000, 2000, 3000, sslContext);
RequestExecutor executor = new RequestExecutor(httpClient, config);
// 在必要的时候关闭
executor.close();
// 普通请求
Request req = ...;
Response resp = executor.execute(req);
// 涉及下载文件的请求
Request req = ...;
ResponseBodyHandler handler = ...;
Response resp = executor.execute(req, handler);