use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method toStringPrintsAttributeNames.
@Test
public void toStringPrintsAttributeNames() throws Exception {
TlsSettings tlsSettings = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).protocols(List.of("TLSv1", "TLSv1.2")).build();
assertThat(tlsSettings.toString(), containsString("protocols=[TLSv1, TLSv1.2]"));
assertThat(tlsSettings.toString(), containsString("cipherSuites=[x, y]"));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class StyxHttpClientTest method usesDefaultTlsSettings.
/*
* StyxHttpClient
* - Applies default TLS settings
*/
@Test
public void usesDefaultTlsSettings() throws ExecutionException, InterruptedException {
StyxHttpClient client = new StyxHttpClient.Builder().tlsSettings(new TlsSettings.Builder().build()).build();
HttpResponse response = client.send(secureRequest).get();
assertThat(response.status(), is(OK));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class StyxServerTest method startsProxyOnSpecifiedHttpsPort.
@Test
public void startsProxyOnSpecifiedHttpsPort() {
styxServer = new StyxServer.Builder().proxyHttpsPort(0).addRoute("/", originServer1.port()).start();
StyxHttpClient tlsClient = new StyxHttpClient.Builder().tlsSettings(new TlsSettings.Builder().build()).build();
HttpResponse response = await(tlsClient.sendRequest(get(format("https://localhost:%d/", styxServer.proxyHttpsPort())).build()));
assertThat(response.status(), is(OK));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method serialisesTrustStorePathAndPassword.
@Test
public void serialisesTrustStorePathAndPassword() throws Exception {
TlsSettings tlsSettings = new TlsSettings.Builder().trustStorePath("/path/to/truststore").trustStorePassword("foobar").build();
String result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(tlsSettings);
assertThat(result, containsString("\"trustStorePath\" : \"/path/to/truststore\""));
assertThat(result, containsString("\"trustStorePassword\" : \"foobar\""));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method appliesDefaultTruststoreSettings.
@Test
public void appliesDefaultTruststoreSettings() throws Exception {
TlsSettings tlsSettings = new TlsSettings.Builder().build();
assertThat(tlsSettings.trustAllCerts(), is(true));
assertThat(tlsSettings.sslProvider(), is("JDK"));
assertThat(tlsSettings.additionalCerts().isEmpty(), is(true));
assertThat(tlsSettings.trustStorePath(), endsWith(new File("security/cacerts").getPath()));
assertThat(tlsSettings.trustStorePassword(), is("".toCharArray()));
assertThat(tlsSettings.protocols(), is(Collections.emptyList()));
assertThat(tlsSettings.cipherSuites(), is(Collections.emptyList()));
assertThat(tlsSettings.sendSni(), is(true));
assertThat(tlsSettings.sniHost(), is(Optional.empty()));
}
Aggregations