When disabling HTTP in favor for HTTPS, by setting the port to -1 or httpDisabled to true, the application is crashing with the following exception:
java.lang.IllegalStateException: Not listening on HTTP port. Either HTTP is not enabled or the WireMock server is stopped.
at com.github.tomakehurst.wiremock.common.ParameterUtils.checkState(ParameterUtils.java:54)
at com.github.tomakehurst.wiremock.WireMockServer.port(WireMockServer.java:209)
at org.wiremock.spring.internal.WireMockSpringJunitExtension.configureWireMockForDefaultInstance(WireMockSpringJunitExtension.java:80)
at org.wiremock.spring.internal.WireMockSpringJunitExtension.beforeEach(WireMockSpringJunitExtension.java:38)
The error is caused by this call of a logging statement in WireMockSpringJunitExtension. Regardless of whether http is disabled or not, the port function of the Wiremock instance gets called. However, the port function has a “state checker” and triggers an exception that you can see above when trying to get the (HTTP) port but HTTP was disabled.
public int port() {
checkState(
isRunning() && !options.getHttpDisabled(),
"Not listening on HTTP port. Either HTTP is not enabled or the WireMock server is stopped.");
return httpServer.port();
}
When disabling HTTP in favor for HTTPS, by setting
the port to -1 orhttpDisabled to true, the application is crashing with the following exception:The error is caused by this call of a logging statement in WireMockSpringJunitExtension. Regardless of whether http is disabled or not, the port function of the Wiremock instance gets called. However, the port function has a “state checker” and triggers an exception that you can see above when trying to get the (HTTP) port but HTTP was disabled.