use of org.mule.runtime.module.tls.internal.DefaultTlsContextFactory in project mule by mulesoft.
the class DefaultTlsContextFactoryTestCase method cannotMutateEnabledProtocols.
@Test
public void cannotMutateEnabledProtocols() throws InitialisationException {
TlsContextFactory tlsContextFactory = new DefaultTlsContextFactory(emptyMap());
initialiseIfNeeded(tlsContextFactory);
tlsContextFactory.getEnabledProtocols()[0] = "TLSv1";
assertThat(tlsContextFactory.getEnabledProtocols(), arrayWithSize(2));
assertThat(tlsContextFactory.getEnabledProtocols(), arrayContaining("TLSv1.1", "TLSv1.2"));
}
use of org.mule.runtime.module.tls.internal.DefaultTlsContextFactory in project mule by mulesoft.
the class DefaultTlsContextFactoryTestCase method cannotMutateEnabledCipherSuites.
@Test
public void cannotMutateEnabledCipherSuites() throws InitialisationException {
TlsContextFactory tlsContextFactory = new DefaultTlsContextFactory(emptyMap());
initialiseIfNeeded(tlsContextFactory);
tlsContextFactory.getEnabledCipherSuites()[0] = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256";
assertThat(tlsContextFactory.getEnabledCipherSuites(), arrayWithSize(2));
assertThat(tlsContextFactory.getEnabledCipherSuites(), arrayContaining("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256", "TLS_DHE_DSS_WITH_AES_128_CBC_SHA"));
}
use of org.mule.runtime.module.tls.internal.DefaultTlsContextFactory in project mule by mulesoft.
the class DefaultTlsContextFactoryTestCase method failIfTrustStoreIsNonexistent.
@Test
public void failIfTrustStoreIsNonexistent() throws Exception {
DefaultTlsContextFactory tlsContextFactory = new DefaultTlsContextFactory(emptyMap());
expectedException.expect(IOException.class);
expectedException.expectMessage(containsString("Resource non-existent-trust-store could not be found"));
tlsContextFactory.setTrustStorePath("non-existent-trust-store");
}
use of org.mule.runtime.module.tls.internal.DefaultTlsContextFactory in project mule by mulesoft.
the class DefaultTlsContextFactoryTestCase method useConfigFileIfDefaultProtocolsAndCipherSuites.
@Test
public void useConfigFileIfDefaultProtocolsAndCipherSuites() throws Exception {
DefaultTlsContextFactory tlsContextFactory = new DefaultTlsContextFactory(emptyMap());
tlsContextFactory.setEnabledCipherSuites("DEFAULT");
tlsContextFactory.setEnabledProtocols("default");
tlsContextFactory.initialise();
assertThat(tlsContextFactory.getEnabledCipherSuites(), is(StringUtils.splitAndTrim(getFileEnabledCipherSuites(), ",")));
assertThat(tlsContextFactory.getEnabledProtocols(), is(StringUtils.splitAndTrim(getFileEnabledProtocols(), ",")));
}
Aggregations