Hi, i'm trying to record a proxied request to an e...
# help
s
Hi, i'm trying to record a proxied request to an external service with the following code and restassured. However, when running this I get a
java.net.ConnectException: Connection refused: connect
. What am I missing here?
Copy code
public class CreateStubs {
    @Test
    void recordStubs() {
        WireMock wireMockClient = new WireMock(9080);

        given()
            .baseUri("<http://localhost:9080/>")
            .body("...")
        .when()
            .post("...")
        .then()
            .log();

        wireMockClient.saveMappings();
    }
}
t
Looks like you’ve created a client but there’s no server. I suggest you either use the JUnit 5 integration, in which case you can just annotate the class with
@WireMockTest
or you can create the server programmatically:
Copy code
WireMockServer wm = new WireMockServer(9080);
wm.start();
WireMock wireMockClient = new WireMock(9080);