Hello Tom,
Here is my scenario,
i have one Client exe which is an application itself and use to create some designs and it connects to one kind of server which acts as database for my client the communication between them is based on http (thats means database server is local).
but as in many cases it is very difficult to create failed response from server but those are necessary in order to make client handle such responses.
so the best solution is to create a mock server using wiremock with which my client connects and in the extension i can write my extension which will responce to perticular request and for other requests it will proxy to the server and the server should response back to the client exe. (this my current requirement)
i have done the preparetion and created the wiremock.jar with my extension included and run with the following command for e.g.
"java -jar NewWiremock.jar --port 2808 --proxy-all="
http://myserver:1090" --extension com.github.tomakehurst.wiremock.extension.sWExtension -verbose"
then, i run the client with the following configuration hostname:- localhost, port:- 2808, uri:- myuri after that client request wiremock for connection (i also got request header in my extension and can print it as well) which wiremock forwarded to myserver as
"
"
which pops up login dialog from myserver then i put username password in it and then ok to the dialog which offcourse athenticated by server but the problem is in the meantime the wiremock caused the following exception.while messages are exchanged between client and server
"
java.lang.IllegalArgumentException: MIME type may not contain reserved characters
at wiremock.org.apache.http.util.Args.check(Args.java:36)
at wiremock.org.apache.http.entity.ContentType.create(ContentType.java:181)
at wiremock.org.apache.http.entity.ContentType.create(ContentType.java:209)
at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.buildEntityFrom(ProxyResponseRenderer.java:165)
at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.addBodyIfPostPutOrPatch(ProxyResponseRenderer.j
at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.render(ProxyResponseRenderer.java:75)
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(Jetty6HandlerDispatchingSer
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at wiremock.org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at wiremock.org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
at wiremock.org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at wiremock.org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at wiremock.org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at wiremock.org.mortbay.jetty.Server.handle(Server.java:326)
at wiremock.org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at wiremock.org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at wiremock.org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at wiremock.org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at wiremock.org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at wiremock.org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at com.github.tomakehurst.wiremock.jetty6.DelayableSocketConnector$1.run(DelayableSocketConnector.java:49)
at wiremock.org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
"
as a result the connection failed and we are not able to work with such scenario.
however if i use internet browser(here google chrome is my client) to connect with wiremock (which ultimatly forward request to myserver) is working fine
that means through browser i type
http://localhost:2808/myuri, i got login dialog from myserver and get successful connection with myserver and able to work with it.
however in this case after connection we are not getting requests in my extension.
so can please have a look into the issue described above and let us know what should i do to make it work.
thank you,
Best regards,
Sumit