Proxy Servers Creation

Use to create a proxy server by specifying target url def proxyServer = server.proxy("test-proxy-server", targetServer.baseUrl)

Override Calls

Use to modify response of a proxied server def router = server.router("optional-router-id") router.get("/another/{id}", (request) -> server.response([anotherId: request.param("id")])) proxyServer.addOverride(router) Note: override will not call proxied server, and will return a provided response

Preserve Original Call

Use HTTP/introduction HTTP Module to issue a call to a destination server with a possibility to change a request and provide a modified response.Example of a proxy server that makes original call, but returns an error def router = server.router().post("/hello", { request -> def message = http.post(http.concatUrl(proxyServer.urlToProxy, request.path), http.header(request.header), request.contentAsMap) { return body.message } // optional logic with original response return server.statusCode(500) }) proxyServer.addOverride(router)

Server Slowdown

Use to mark server as unresponsive proxyServer.markUnresponsive() code { http.get("${proxyServer.baseUrl}/another/hello") { body.should == [anotherId: "hello"] } } should throwException(~/request timed out/)

Server Break

Use to mark server as broken proxyServer.markBroken() http.get("${proxyServer.baseUrl}/hello.html") { statusCode.should == 500 body.should == null }

Server Fix

Use to remove broken and/or slowdown state proxyServer.fix()

Max Threads

Use serverProxyMaxThreads to change max number of threads available for proxy server