mock-server / mockserver

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
http://mock-server.com
Apache License 2.0
4.54k stars 1.06k forks source link

MockServerClient always uses new/empty configuration #1453

Closed smithap closed 1 year ago

smithap commented 1 year ago

I want to pass in an updated socket timeout:

org.mockserver.configuration.Configuration c = new org.mockserver.configuration.Configuration(); c.maxSocketTimeoutInMillis(30_000L); mockServer = startClientAndServer(c, port);

but I think the configuration in the client is not honoured? A fresh Configuration is always created at https://github.com/mock-server/mockserver/blob/master/mockserver-client-java/src/main/java/org/mockserver/client/MockServerClient.java#L366

So if/when a timeout occurs, the error message in the exception says:

org.mockserver.httpclient.SocketCommunicationException: Response was not received from MockServer after 20000 milliseconds, to wait longer please use "mockserver.maxSocketTimeout" system property or ConfigurationProperties.maxSocketTimeout(long milliseconds) at org.mockserver.httpclient.NettyHttpClient.sendRequest(NettyHttpClient.java:192) at org.mockserver.client.MockServerClient.sendRequest(MockServerClient.java:393)

Or perhaps I'm just doing something wrong?

jamesdbloom commented 1 year ago

Good catch, I'll fix that.