Migrate remaining usage of httpclient API

This commit migrates our remaining usage of the httpclient 4.x to use
instead httpclient5, now that the 4.x support has been removed in
`RestTemplate`.

Closes gh-32461
This commit is contained in:
Brian Clozel
2022-09-21 16:14:23 +02:00
parent cc169e7623
commit a0735eb3fb
12 changed files with 116 additions and 121 deletions

View File

@@ -18,10 +18,12 @@ package org.springframework.boot.deployment;
import java.io.File;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
import org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.util.TimeValue;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import org.junit.jupiter.api.Test;
@@ -96,7 +98,9 @@ abstract class AbstractDeploymentTests {
.rootUri("http://" + this.container.getHost() + ":" + this.container.getMappedPort(this.port)
+ "/spring-boot")
.requestFactory(() -> new HttpComponentsClientHttpRequestFactory(HttpClients.custom()
.setRetryHandler(new StandardHttpRequestRetryHandler(10, false)).build())));
.setRetryStrategy(
new DefaultHttpRequestRetryStrategy(10, TimeValue.of(1, TimeUnit.SECONDS)))
.build())));
try {
Awaitility.await().atMost(Duration.ofMinutes(10)).until(() -> {
try {