【发布时间】:2020-02-17 11:29:15
【问题描述】:
我正在运行一个独立的 Wiremock 实例,用于在 JUnit 测试中进行模拟。这适用于 http,如果我使用带有开关 --https-port 8443 的wiremock自签名证书。但是,如果我指定 --https-keystore server_keystore.jks,任何与 Wiremock 通信的尝试,例如 WireMock.reset(); 都会抛出 javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake。在浏览器中连接到管理页面 https://localhost:9093/__admin/ 会显示有关连接被关闭的类似错误。
keystore 生成如下;
keytool -genkey -keyalg RSA -keysize 2048 -alias server -keypass secret -storepass secret -keystore server_keystore.jks
如果我为 Wiremock 中的所有流量启用日志记录,我会看到;
Problem decoding network traffic
java.nio.charset.MalformedInputException: Input length = 1
在尝试与 Wiremock 通信但未成功之前,我在调用代码中添加了 System.setProperty("javax.net.ssl.trustStore", "server_keystore.jks");。
【问题讨论】:
标签: wiremock wiremock-standalone