Skip to content

Commit

Permalink
Merge pull request #986 from emmartins/thread-racing-pkix
Browse files Browse the repository at this point in the history
  • Loading branch information
emmartins authored Dec 4, 2024
2 parents 06f39c0 + 2bf3527 commit 169dab7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion thread-racing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client-api</artifactId>
<artifactId>resteasy-client</artifactId>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 169dab7

Please sign in to comment.