https://linen.dev logo
#wiremock-java
Title
# wiremock-java
s

Sinan Pehlivanoglu

01/17/2023, 5:43 PM
Hello! I have been trying to port our tests from MockServer to WireMock at work. Sadly it hasn't gone as smooth as I was hoping. I hit some issues, was hoping you could give a few ideas. I had some original questions but in the time being WireMockServer completely stopped working 😅
Copy code
Not listening on HTTP port. Either HTTP is not enabled or the WireMock server is stopped.
java.lang.IllegalStateException: Not listening on HTTP port. Either HTTP is not enabled or the WireMock server is stopped.
	at wiremock.com.google.common.base.Preconditions.checkState(Preconditions.java:444)
	at com.github.tomakehurst.wiremock.WireMockServer.port(WireMockServer.java:179)
Found this: https://github.com/bakdata/fluent-kafka-streams-tests/issues/22 and this: https://groups.google.com/g/wiremock-user/c/4kkOMn58CzM?pli=1 JUnit version
4.13.2
testImplementation "junit:junit:4.13.2"
Being going through the recently merged code to see what could have caused this in the past 24 hours but I can't quite tell.
Copy code
private Environment newEnvironmentInstance(.....) {
        .... some code here .... 

        final WireMockConfiguration config = wireMockConfig().dynamicPort();
        final WireMockServer mockServer = new WireMockServer(config);
        environment.setUrl(URI.create("<http://localhost>:" + mockServer.port()));
        environment.setService(URI.create("<http://localhost>:" + mockServer.port()));
        environment.setInitial(initial);
        <http://logger.info|logger.info>("Environment started: {} on port {} ({})",
                environment.getId(), mockServer.port(), environment.getName());

        mockServer.start();

        mockServer.stubFor(.....)
  }
Any thoughts what might have caused this?
2 Views