Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
When running this against the HttpServer in the MP Rest Client 1.3 TCK, I get the following exception:
public class TestSSLwithStores {
private static String TEST_URL = "https://localhost:8948";
private static String SSL_DIR = "/path/to/microprofile-rest-client/tck/src/main/resources/ssl/";
public static void main(String[] args) throws Throwable {
InputStream keyStream = new FileInputStream(SSL_DIR + "client.keystore");
InputStream trustStream = new FileInputStream(SSL_DIR + "client.truststore");
char[] password = "password".toCharArray();
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(keyStream, password);
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(trustStream, password);
KeyManagerFactory keyFactory =
keyFactory.init(keyStore, password);
KeyManager[] keyManagers = keyFactory.getKeyManagers();
TrustManagerFactory trustFactory =
TrustManager[] trustManagers = trustFactory.getTrustManagers();
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(keyManagers, trustManagers, null);
URL url = new URL(TEST_URL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
Copy link

andymc12 commented May 9, 2019

I built the TestSSLWithStores class using guidance from:

Here is the exception I see when running this agains the HttpsServer in the MP Rest Client 1.3 TCK:

Exception in thread "main" readHandshakeRecord
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	at TestSSLwithStores.main(
Caused by: Broken pipe (Write failed)
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	at java.base/$T13FinishedProducer.onProduceFinished(
	at java.base/$T13FinishedProducer.produce(
	at java.base/
	at java.base/$T13FinishedConsumer.onConsumeFinished(
	at java.base/$T13FinishedConsumer.consume(
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	at java.base/
	... 5 more

When I test this with Apache CXF, I see these tests fail with essentially the same stack trace:

[INFO] Results:
[ERROR] Failures: 
[ERROR]   SslContextTest>>shouldSucceedMutualSslWithValidSslContext:65 » Processing
[ERROR]   SslMutualTest>>shouldWorkWithClientSignature:121 » Processing
[ERROR]   SslMutualTest>>shouldWorkWithClientSignatureCDI:143 » Processing
[ERROR]   SslMutualTest>>shouldWorkWithClientSignatureFromClasspathCDI:148 » Processing

Note that the line number may be off somewhat, as I added the following code to the tests to allow me time to try running the standalone test case above:

System.out.println("ANDY: try it now: https://localhost:8948/");
        try {
        catch (Throwable t) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment