jakarta.ws.rs.client.ClientBuilder#trustStore isn't used in the creation process - if a server has a custom truststore that its certificate is signed by, the client will have an error when connecting.
As a workaround, the truststore can be passed to the underlying ClientConnector directly.
final ClientConnector clientConnector = new ClientConnector();
// Workaround, explicitly create the sslcontextfactory and pass to the connector
SslContextFactory.Client sslContextFactory = new SslContextFactory.Client();
sslContextFactory.setTrustStore(keyStore);
clientConnector.setSslContextFactory(sslContextFactory);
final ClientConnectionFactory.Info h1 = HttpClientConnectionFactory.HTTP11;
final HTTP2Client http2Client = new HTTP2Client(clientConnector);
final ClientConnectionFactory.Info h2 = new ClientConnectionFactoryOverHTTP2.HTTP2(http2Client);
final HttpClientTransport transport = new HttpClientTransportDynamic(clientConnector, h2, h1);
final HttpClient c = new HttpClient(transport);
ClientBuilder clientBuilder =
ClientBuilder.newBuilder().register(new JettyClientEngine(c));
// This will not work as of 1.0.0-alpha2
clientBuilder = clientBuilder.trustStore(keyStore);
jakarta.ws.rs.client.ClientBuilder#trustStore isn't used in the creation process - if a server has a custom truststore that its certificate is signed by, the client will have an error when connecting.
As a workaround, the truststore can be passed to the underlying ClientConnector directly.