I'm running a stand-alone instance of Wiremock for mocking in JUnit tests. This works fine with http and if I use the wiremock self-signed cert with the switch --https-port 8443
. If I specify --https-keystore server_keystore.jks
however, any attempt to communicate with Wiremock e.g WireMock.reset();
throws a javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
. Connecting to the admin page https://localhost:9093/__admin/
in a browser shows a similar error about the connection being closed.
The keystore was generated as follows;
keytool -genkey -keyalg RSA -keysize 2048 -alias server -keypass secret -storepass secret -keystore server_keystore.jks
If I enable logging for all traffic in Wiremock I see;
Problem decoding network traffic
java.nio.charset.MalformedInputException: Input length = 1
I've added System.setProperty("javax.net.ssl.trustStore", "server_keystore.jks");
in my calling code prior to attempting to communicate with Wiremock with no success.