@Test public void testFirstAlias() { try { SSLContextBuilder.builder() .setKeyStorePath(KEYSTORE_PATH) .setKeyStorePassword(KEYSTORE_PASSWORD) .setKeyAlias(KEYSTORE_ALIAS_ONE) .build(); } catch (RuntimeException e) { fail(e.getMessage()); } }
@Test public void testSecondAlias() { try { SSLContextBuilder.builder() .setKeyStorePath(KEYSTORE_PATH) .setKeyStorePassword(KEYSTORE_PASSWORD) .setKeyAlias(KEYSTORE_ALIAS_TWO) .build(); } catch (RuntimeException e) { fail(e.getMessage()); } }
SSLContext sslContext = SSLContextBuilder.builder() .setKeyStorePath(KEYSTORE_PATH) .setKeyStorePassword(KEYSTORE_PASSWORD) .setKeyAlias(KEYSTORE_KEYALIAS).build(); undertowBuilder = undertowBuilder.addHttpsListener(portTls,
SSLContext sslContext = SSLContextBuilder.builder() .setKeyStorePath(KEYSTORE_PATH) .setKeyStorePassword(KEYSTORE_PASSWORD) .setKeyAlias(KEYSTORE_KEYALIAS).build(); undertowBuilder = undertowBuilder.addHttpsListener(portTls,
@Test public void testIncorrectPassword() { try { SSLContextBuilder.builder() .setKeyStorePath(KEYSTORE_PATH) .setKeyStorePassword("bla") .setKeyAlias(KEYSTORE_ALIAS_ONE) .build(); // should fail fail("Exception not thrown"); } catch (RuntimeException e) { assertTrue(e.getCause() instanceof IOException); } } }
@Test public void testNonExistingAlias() { try { SSLContextBuilder.builder() .setKeyStorePath(KEYSTORE_PATH) .setKeyStorePassword(KEYSTORE_PASSWORD) .setKeyAlias("bla") .build(); // should fail fail("Exception not thrown"); } catch (RuntimeException e) { assertTrue(e.getCause() instanceof IllegalArgumentException); } }