Index: /trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java	(revision 19155)
+++ /trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java	(revision 19156)
@@ -38,4 +38,6 @@
 import java.util.stream.Collectors;
 
+import com.github.tomakehurst.wiremock.client.WireMock;
+import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -51,5 +53,4 @@
 import org.openstreetmap.josm.tools.HttpClient.Response;
 
-import com.github.tomakehurst.wiremock.WireMockServer;
 import com.github.tomakehurst.wiremock.admin.model.ServeEventQuery;
 import com.github.tomakehurst.wiremock.http.HttpHeader;
@@ -69,6 +70,5 @@
      * mocked local http server
      */
-    @BasicWiremock
-    public WireMockServer localServer;
+    private WireMockRuntimeInfo wireMockRuntimeInfo;
 
     private ProgressMonitor progress;
@@ -95,6 +95,6 @@
      */
     @BeforeEach
-    public void setUp() {
-        localServer.resetAll();
+    public void setUp(WireMockRuntimeInfo wireMockRuntimeInfo) {
+        this.wireMockRuntimeInfo = wireMockRuntimeInfo;
         progress = TestUtils.newTestProgressMonitor();
         captured = null;
@@ -132,5 +132,5 @@
     void testGet() throws IOException {
         final UrlPattern pattern = urlEqualTo("/get?foo=bar");
-        localServer.stubFor(get(pattern).willReturn(aResponse().withStatusMessage("OK")
+        wireMockRuntimeInfo.getWireMock().register(get(pattern).willReturn(aResponse().withStatusMessage("OK")
                 .withHeader("Content-Type", "application/json; encoding=utf-8")));
         final Response response = connect("/get?foo=bar");
@@ -143,5 +143,5 @@
         assertThat(response.getHeaderFields().get("Content-Type"), is(Collections.singletonList("application/json; encoding=utf-8")));
         assertThat(response.getHeaderFields().get("Content-TYPE"), is(Collections.singletonList("application/json; encoding=utf-8")));
-        localServer.verify(getRequestedFor(pattern)
+        wireMockRuntimeInfo.getWireMock().verifyThat(getRequestedFor(pattern)
                 .withQueryParam("foo", equalTo("bar"))
                 .withoutHeader("Cache-Control")
@@ -156,7 +156,7 @@
     void testHeaders() throws IOException {
         final UrlPattern pattern = urlEqualTo("/headers");
-        localServer.stubFor(get(pattern).willReturn(aResponse()));
+        wireMockRuntimeInfo.getWireMock().register(get(pattern).willReturn(aResponse()));
         connect("/headers");
-        localServer.verify(getRequestedFor(pattern)
+        wireMockRuntimeInfo.getWireMock().verifyThat(getRequestedFor(pattern)
                 .withHeader("Accept", equalTo("*/*"))
                 .withHeader("Accept-Encoding", equalTo("gzip, deflate"))
@@ -170,5 +170,5 @@
     @Test
     void testFetchUtf8Content() throws IOException {
-        localServer.stubFor(get(urlEqualTo("/encoding/utf8"))
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/encoding/utf8"))
                 .willReturn(aResponse().withBody("∀x∈ℝ: UTF-8 encoded sample plain-text file")));
         final Response response = connect("/encoding/utf8");
@@ -186,5 +186,5 @@
     void testPost() throws IOException {
         final UrlPattern pattern = urlEqualTo("/post");
-        localServer.stubFor(post(pattern).willReturn(aResponse()));
+        wireMockRuntimeInfo.getWireMock().register(post(pattern).willReturn(aResponse()));
         final String text = "Hello World!\nGeetings from JOSM, the Java OpenStreetMap Editor";
         final Response response = HttpClient.create(url("/post"), "POST")
@@ -195,5 +195,5 @@
         assertThat(response.getResponseCode(), is(200));
         assertThat(response.getRequestMethod(), is("POST"));
-        localServer.verify(postRequestedFor(pattern).withRequestBody(equalTo(text)));
+        wireMockRuntimeInfo.getWireMock().verifyThat(postRequestedFor(pattern).withRequestBody(equalTo(text)));
     }
 
@@ -205,5 +205,5 @@
     void testPostZero() throws IOException {
         final UrlPattern pattern = urlEqualTo("/post");
-        localServer.stubFor(post(pattern).willReturn(aResponse()));
+        wireMockRuntimeInfo.getWireMock().register(post(pattern).willReturn(aResponse()));
         final byte[] bytes = "".getBytes(StandardCharsets.UTF_8);
         final Response response = HttpClient.create(url("/post"), "POST")
@@ -214,5 +214,5 @@
         assertThat(response.getResponseCode(), is(200));
         assertThat(response.getRequestMethod(), is("POST"));
-        localServer.verify(postRequestedFor(pattern).withRequestBody(binaryEqualTo(bytes)));
+        wireMockRuntimeInfo.getWireMock().verifyThat(postRequestedFor(pattern).withRequestBody(binaryEqualTo(bytes)));
     }
 
@@ -265,13 +265,13 @@
         final String localhost = "localhost";
         final String localhostIp = "127.0.0.1";
-        final String otherServer = this.localServer.baseUrl().contains(localhost) ? localhostIp : localhost;
-        final UUID redirect = this.localServer.stubFor(get(urlEqualTo("/redirect/other-site"))
+        final String otherServer = this.wireMockRuntimeInfo.getHttpBaseUrl().contains(localhost) ? localhostIp : localhost;
+        final UUID redirect = this.wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/redirect/other-site"))
                 .willReturn(aResponse().withStatus(302).withHeader(
-                        "Location", localServer.url("/same-site/other-site")))).getId();
-        final UUID sameSite = this.localServer.stubFor(get(urlEqualTo("/same-site/other-site"))
+                        "Location", wireMockRuntimeInfo.getHttpBaseUrl() + "/same-site/other-site"))).getId();
+        final UUID sameSite = this.wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/same-site/other-site"))
                 .willReturn(aResponse().withStatus(302).withHeader(
-                        "Location", localServer.url("/other-site")
+                        "Location", (this.wireMockRuntimeInfo.getHttpBaseUrl() + "/other-site")
                                 .replace(otherServer == localhost ? localhostIp : localhost, otherServer)))).getId();
-        final UUID otherSite = this.localServer.stubFor(get(urlEqualTo("/other-site"))
+        final UUID otherSite = this.wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/other-site"))
                 .willReturn(aResponse().withStatus(200).withBody("other-site-here"))).getId();
         final HttpClient client = HttpClient.create(url("/redirect/other-site"));
@@ -279,9 +279,10 @@
         try {
             client.connect();
-            this.localServer.getServeEvents();
-            final ServeEvent first = this.localServer.getServeEvents(ServeEventQuery.forStubMapping(redirect)).getRequests().get(0);
-            final ServeEvent second = this.localServer.getServeEvents(ServeEventQuery.forStubMapping(sameSite)).getRequests().get(0);
-            final ServeEvent third = this.localServer.getServeEvents(ServeEventQuery.forStubMapping(otherSite)).getRequests().get(0);
-            assertAll(() -> assertEquals(3, this.localServer.getServeEvents().getRequests().size()),
+            final WireMock wireMock = this.wireMockRuntimeInfo.getWireMock();
+            wireMock.getServeEvents();
+            final ServeEvent first = wireMock.getServeEvents(ServeEventQuery.forStubMapping(redirect)).get(0);
+            final ServeEvent second = wireMock.getServeEvents(ServeEventQuery.forStubMapping(sameSite)).get(0);
+            final ServeEvent third = wireMock.getServeEvents(ServeEventQuery.forStubMapping(otherSite)).get(0);
+            assertAll(() -> assertEquals(3, wireMock.getServeEvents().size()),
                     () -> assertEquals(authorization, first.getRequest().getHeader("Authorization"),
                     "Authorization is expected for the first request: " + first.getRequest().getUrl()),
@@ -389,5 +390,5 @@
     @Test
     void testGzip() throws IOException {
-        localServer.stubFor(get(urlEqualTo("/gzip")).willReturn(aResponse().withBody("foo")));
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/gzip")).willReturn(aResponse().withBody("foo")));
         final Response response = connect("/gzip");
         assertThat(response.getResponseCode(), is(200));
@@ -404,5 +405,5 @@
         final Path path = Paths.get(TestUtils.getTestDataRoot(), "tracks/tracks.gpx.gz");
         final byte[] gpx = Files.readAllBytes(path);
-        localServer.stubFor(get(urlEqualTo("/trace/1613906/data"))
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/trace/1613906/data"))
                 .willReturn(aResponse()
                         .withStatus(200)
@@ -410,5 +411,5 @@
                         .withBody(gpx)));
 
-        final URL url = new URL(localServer.url("/trace/1613906/data"));
+        final URL url = new URL(wireMockRuntimeInfo.getHttpBaseUrl() + "/trace/1613906/data");
         try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) {
             assertThat(x.readLine(), startsWith("<?xml version="));
@@ -424,5 +425,5 @@
         final Path path = Paths.get(TestUtils.getTestDataRoot(), "tracks/tracks.gpx.bz2");
         final byte[] gpx = Files.readAllBytes(path);
-        localServer.stubFor(get(urlEqualTo("/trace/785544/data"))
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/trace/785544/data"))
                 .willReturn(aResponse()
                         .withStatus(200)
@@ -430,5 +431,5 @@
                         .withBody(gpx)));
 
-        final URL url = new URL(localServer.url("/trace/785544/data"));
+        final URL url = new URL(wireMockRuntimeInfo.getHttpBaseUrl() + "/trace/785544/data");
         try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) {
             assertThat(x.readLine(), startsWith("<?xml version="));
@@ -444,5 +445,5 @@
         final Path path = Paths.get(TestUtils.getTestDataRoot(), "tracks/tracks.gpx.bz2");
         final byte[] gpx = Files.readAllBytes(path);
-        localServer.stubFor(get(urlEqualTo("/trace/1350010/data"))
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/trace/1350010/data"))
                 .willReturn(aResponse()
                         .withStatus(200)
@@ -451,5 +452,5 @@
                         .withBody(gpx)));
 
-        final URL url = new URL(localServer.url("/trace/1350010/data"));
+        final URL url = new URL(wireMockRuntimeInfo.getHttpBaseUrl() + "/trace/1350010/data");
         try (BufferedReader x = HttpClient.create(url).connect()
                 .uncompress(true).uncompressAccordingToContentDisposition(true).getContentReader()) {
@@ -482,5 +483,5 @@
 
     private void mockDelay(int seconds) {
-        localServer.stubFor(get(urlEqualTo("/delay/" + seconds))
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/delay/" + seconds))
                 .willReturn(aResponse().withFixedDelay(1000 * seconds)));
     }
@@ -490,9 +491,9 @@
         for (int i = n; i > 0; i--) {
             final String location = "/" + prefix + "-redirect/" + (i-1);
-            localServer.stubFor(get(urlEqualTo("/" + prefix + "-redirect/" + i))
+            wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/" + prefix + "-redirect/" + i))
                     .willReturn(aResponse().withStatus(302).withHeader(
-                            "Location", absolute ? localServer.url(location) : location)));
-        }
-        localServer.stubFor(get(urlEqualTo("/" + prefix + "-redirect/0"))
+                            "Location", absolute ? wireMockRuntimeInfo.getHttpBaseUrl() + location : location)));
+        }
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/" + prefix + "-redirect/0"))
                 .willReturn(aResponse().withHeader("foo", "bar")));
     }
@@ -503,5 +504,5 @@
 
     private Response doTestHttp(int responseCode, String message, String body, Map<String, String> headersMap) throws IOException {
-        localServer.stubFor(get(urlEqualTo("/status/" + responseCode))
+        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/status/" + responseCode))
                 .willReturn(aResponse().withStatus(responseCode).withStatusMessage(message).withBody(body).withHeaders(
                         new HttpHeaders(headersMap.entrySet().stream().map(
@@ -522,5 +523,5 @@
 
     private URL url(String path) throws MalformedURLException {
-        return new URL(localServer.url(path));
+        return new URL(wireMockRuntimeInfo.getHttpBaseUrl() + path);
     }
 }
