diff --git a/thread-racing/pom.xml b/thread-racing/pom.xml index 5c97ba9d13..a277ee7680 100644 --- a/thread-racing/pom.xml +++ b/thread-racing/pom.xml @@ -150,7 +150,7 @@ org.jboss.resteasy - resteasy-client-api + resteasy-client jar provided diff --git a/thread-racing/src/main/java/org/jboss/as/quickstarts/threadracing/stage/jaxrs/JAXRSRaceStage.java b/thread-racing/src/main/java/org/jboss/as/quickstarts/threadracing/stage/jaxrs/JAXRSRaceStage.java index e373995363..5c825a8b6c 100644 --- a/thread-racing/src/main/java/org/jboss/as/quickstarts/threadracing/stage/jaxrs/JAXRSRaceStage.java +++ b/thread-racing/src/main/java/org/jboss/as/quickstarts/threadracing/stage/jaxrs/JAXRSRaceStage.java @@ -21,11 +21,16 @@ import org.jboss.as.quickstarts.threadracing.stage.RaceStage; import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.Response; + +import java.security.SecureRandom; import java.util.Map; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.engines.PassthroughTrustManager; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; /** * The Jakarta REST race stage implements the race's boxes, which a racer uses to do a pit stop. @@ -49,8 +54,15 @@ public void run(Race.Registration registration) throws Exception { .append("/pitStop") .toString(); // create and setup the new standard Jakarta REST client (and its web target) - final Client client = ((ResteasyClientBuilder) ClientBuilder.newBuilder()) - .build(); + // please note that it uses a custom SSLContext that trusts any certificate, this should not be used on production + final SSLContext sslContext = SSLContext.getInstance("SSL"); + sslContext.init( + null, + new TrustManager[] { new PassthroughTrustManager() }, + new SecureRandom()); + final Client client = ResteasyClientBuilder.newBuilder() + .sslContext(sslContext) + .build(); try { final WebTarget target = client.target(pitStopURI); // get current time