diff --git a/apache-httpclient/pom.xml b/apache-httpclient/pom.xml index 1b22d64799..3b178d4df8 100644 --- a/apache-httpclient/pom.xml +++ b/apache-httpclient/pom.xml @@ -58,11 +58,16 @@ - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test + + org.apache.httpcomponents + httpclient + ${httpclient.version} + @@ -77,11 +82,12 @@ 5.6.1 - 2.5.1 + 3.3.1 5.2 5.2 5.2 + 4.5.14 diff --git a/apache-httpclient/src/test/java/com/baeldung/httpclient/GetRequestMockServer.java b/apache-httpclient/src/test/java/com/baeldung/httpclient/GetRequestMockServer.java index 92cb452dc8..1a4f4aebf3 100644 --- a/apache-httpclient/src/test/java/com/baeldung/httpclient/GetRequestMockServer.java +++ b/apache-httpclient/src/test/java/com/baeldung/httpclient/GetRequestMockServer.java @@ -8,7 +8,7 @@ import static org.mockserver.model.HttpResponse.response; import java.io.IOException; import java.net.ServerSocket; -import org.apache.http.HttpStatus; +import org.apache.hc.core5.http.HttpStatus; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.mockserver.client.MockServerClient; diff --git a/apache-httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java b/apache-httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java index d421de1c7a..50cf1b7a64 100644 --- a/apache-httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java +++ b/apache-httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java @@ -38,8 +38,6 @@ import org.junit.jupiter.api.Test; class HttpAsyncClientLiveTest extends GetRequestMockServer { - - private static final String HOST = "http://www.google.com"; private static final String HOST_WITH_SSL = "https://mms.nw.ru/"; private static final String HOST_WITH_PROXY = "http://httpbin.org/"; private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php";// "http://localhost:8080/spring-security-rest-basic-auth/api/foos/1"; @@ -136,7 +134,7 @@ class HttpAsyncClientLiveTest extends GetRequestMockServer { client.start(); - final SimpleHttpRequest request = new SimpleHttpRequest("GET",HOST_WITH_SSL); + final SimpleHttpRequest request = new SimpleHttpRequest("GET", HOST_WITH_SSL); final Future future = client.execute(request, null); final HttpResponse response = future.get(); @@ -201,7 +199,7 @@ class HttpAsyncClientLiveTest extends GetRequestMockServer { @Override public void run() { try { - final Future future = client.execute(SimpleHttpRequest.copy(request), context, null); + final Future future = client.execute(SimpleRequestBuilder.copy(request).build(), context, null); final HttpResponse response = future.get(); assertThat(response.getCode(), equalTo(200)); } catch (final Exception ex) { diff --git a/apache-httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java b/apache-httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java index e9ea08a723..537f501d93 100644 --- a/apache-httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java +++ b/apache-httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java @@ -1,10 +1,10 @@ package com.baeldung.httpclient; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; - import java.io.IOException; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.core5.http.HttpEntity; + public final class ResponseUtil { private ResponseUtil() { } diff --git a/apache-httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java b/apache-httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java index 3ac3ee88be..2a8665b624 100644 --- a/apache-httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java +++ b/apache-httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java @@ -103,7 +103,7 @@ class HttpClientAdvancedConfigurationIntegrationTest { void givenServerThatIsBehindProxy_whenClientIsConfiguredToSendRequestViaProxy_shouldReturn200() throws IOException { //given proxyMock.stubFor(get(urlMatching(".*")) - .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); + .willReturn(aResponse().proxiedFrom("http://localhost:8089"))); serviceMock.stubFor(get(urlEqualTo("/private")) .willReturn(aResponse().withStatus(200))); @@ -129,7 +129,7 @@ class HttpClientAdvancedConfigurationIntegrationTest { public void givenServerThatIsBehindAuthorizationProxy_whenClientSendRequest_shouldAuthorizeProperly() throws IOException { //given proxyMock.stubFor(get(urlMatching("/private")) - .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); + .willReturn(aResponse().proxiedFrom("http://localhost:8089"))); serviceMock.stubFor(get(urlEqualTo("/private")) .willReturn(aResponse().withStatus(200))); diff --git a/apache-httpclient4/pom.xml b/apache-httpclient4/pom.xml index 8b2fd76f0e..90890ef7b9 100644 --- a/apache-httpclient4/pom.xml +++ b/apache-httpclient4/pom.xml @@ -158,7 +158,7 @@ ${mockserver.version} - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test @@ -237,7 +237,7 @@ 1.16.0 4.1.5 - 2.5.1 + 3.3.1 4.4.16 4.5.14 5.11.2 diff --git a/apache-httpclient4/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java b/apache-httpclient4/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java index 5ced756644..714c01192e 100644 --- a/apache-httpclient4/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java +++ b/apache-httpclient4/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java @@ -102,7 +102,7 @@ class HttpClientAdvancedConfigurationIntegrationTest { void givenServerThatIsBehindProxy_whenClientIsConfiguredToSendRequestViaProxy_shouldReturn200() throws IOException { //given proxyMock.stubFor(get(urlMatching(".*")) - .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); + .willReturn(aResponse().proxiedFrom("http://localhost:8089"))); serviceMock.stubFor(get(urlEqualTo("/private")) .willReturn(aResponse().withStatus(200))); @@ -128,7 +128,7 @@ class HttpClientAdvancedConfigurationIntegrationTest { void givenServerThatIsBehindAuthorizationProxy_whenClientSendRequest_shouldAuthorizeProperly() throws IOException { //given proxyMock.stubFor(get(urlMatching("/private")) - .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); + .willReturn(aResponse().proxiedFrom("http://localhost:8089"))); serviceMock.stubFor(get(urlEqualTo("/private")) .willReturn(aResponse().withStatus(200))); diff --git a/core-java-modules/core-java-httpclient/pom.xml b/core-java-modules/core-java-httpclient/pom.xml index f3730d1b45..fc95366392 100644 --- a/core-java-modules/core-java-httpclient/pom.xml +++ b/core-java-modules/core-java-httpclient/pom.xml @@ -32,7 +32,7 @@ test - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test @@ -58,7 +58,7 @@ 11 3.22.0 5.11.2 - 2.27.2 + 3.3.1 \ No newline at end of file diff --git a/core-java-modules/core-java-io-2/pom.xml b/core-java-modules/core-java-io-2/pom.xml index 8f4f2518fe..8632748baa 100644 --- a/core-java-modules/core-java-io-2/pom.xml +++ b/core-java-modules/core-java-io-2/pom.xml @@ -31,9 +31,8 @@ log4j-over-slf4j ${org.slf4j.version} - - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test @@ -63,7 +62,7 @@ 3.0.0-M1 - 2.26.3 + 3.3.1 \ No newline at end of file diff --git a/httpclient-simple/pom.xml b/httpclient-simple/pom.xml index 8cbc1237c2..a0f2dd6514 100644 --- a/httpclient-simple/pom.xml +++ b/httpclient-simple/pom.xml @@ -99,7 +99,7 @@ ${commons-codec.version} - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test @@ -207,7 +207,7 @@ 1.16.0 - 2.5.1 + 3.3.1 5.2 5.2 diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index 32f75aa676..9ea5f62778 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -85,7 +85,7 @@ ${jersey.version} - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test @@ -219,7 +219,7 @@ 1.6.1 4.4.9 4.5.5 - 2.27.2 + 3.3.1 1.5.10.RELEASE diff --git a/testing-modules/rest-testing/pom.xml b/testing-modules/rest-testing/pom.xml index f8005092ae..975b6fb647 100644 --- a/testing-modules/rest-testing/pom.xml +++ b/testing-modules/rest-testing/pom.xml @@ -34,7 +34,7 @@ - com.github.tomakehurst + org.wiremock wiremock ${wiremock.version} test @@ -135,7 +135,7 @@ 2.9.0 6.8.0 - 2.21.0 + 3.3.1 1.3.1 4.1