I am trying to create stub mappings by recording them while running wiremock as a proxy. I am running wiremock at a SSL port using a default certificate and proxying to an endpoint that expects client cetificate for authentication:
java -jar wiremock-1.50-standalone.jar --port 8080 --https-port 8182 --proxy-all="https://someserverendpoint" --preserve-host-header --record-mappings --verbose
I am not able to see any files in mappings and __files folder as I see the 'SSLHandshakeException'.
How do I get around this?
Any response is appreciated.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wiremock-user/7dbd832c-b98c-403b-af2c-8853eac9810f%40googlegroups.com.--
You received this message because you are subscribed to a topic in the Google Groups "wiremock-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wiremock-user/X-VgopdJ7t4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wiremock-use...@googlegroups.com.
To post to this group, send email to wiremo...@googlegroups.com.
task customWireMockRunner(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'com.github.tomakehurst.wiremock.standalone.WireMockServerRunner'
// arguments to pass to the application
args = ["--https-port=9999",
"--record-mappings=true" , "--verbose=true",
"--https-keystore=/Users/rahul.joshi/Downloads/wiremock/wiremocktrust.jks",
"--keystore-password=password",
"--https-truststore=/Users/rahul.joshi/Downloads/wiremock/wiremocktrust.jks",
"--truststore-password=password",
"--https-require-client-cert=true",
"--proxy-all=https://localhost:8488",
"--preserve-host-header=true"]
jvmArgs = ["-Djavax.net.debug=all", "-Djavax.net.ssl.trustStore=/Users/rahul.joshi/Downloads/wiremock/wiremocktrust.jks"]
}
java.lang.RuntimeException: java.net.SocketException: Broken pipe at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.render(ProxyResponseRenderer.java:85) at com.github.tomakehurst.wiremock.http.StubResponseRenderer.render(StubResponseRenderer.java:47) at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:40) at com.github.tomakehurst.wiremock.jetty6.Jetty6HandlerDispatchingServlet.service(Jetty6HandlerDispatchingServlet.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:713) at com.github.tomakehurst.wiremock.jetty6.DelayableSslSocketConnector$1.run(DelayableSslSocketConnector.java:52) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:153) at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431) at sun.security.ssl.OutputRecord.write(OutputRecord.java:417) at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:876) at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:847) at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:717) at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1077) at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1222) at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1134) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.Protocexecute(ProtocolExec.java:184) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.render(ProxyResponseRenderer.java:76) ... 19 more
Other than double checking that you are attempting to connect to the target system on the right port (https, not http) I can only suggest breaking out tcpdump to confirm whether the app is severing the connection.
.loadKeyMaterial(trustStore, trustStoreSettings.password().toCharArray(), new PrivateKeyStrategy() { @Override public String chooseAlias(Map<String, PrivateKeyDetails> aliases, Socket socket) { return "<alias name passed from command line option only for proxy>"; } })
I agree it'd be useful to be able to use trust stores containing more than one cert so I'd welcome a PR.