use of com.hotels.styx.client.StyxHttpClient in project styx by ExpediaGroup.
the class StyxServerTest method proxiesToOriginViaHttps.
@Test
public void proxiesToOriginViaHttps() {
BackendService backendService = new BackendService().ssl().addOrigin(secureOriginServer.httpsPort());
styxServer = new StyxServer.Builder().addRoute("/", backendService).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));
configureFor(secureOriginServer.port());
WireMock.verify(getRequestedFor(urlPathEqualTo("/")));
}
use of com.hotels.styx.client.StyxHttpClient in project styx by ExpediaGroup.
the class StyxMetrics method downloadJsonString.
private static String downloadJsonString(String host, int port) {
StyxHttpClient client = new StyxHttpClient.Builder().build();
HttpResponse response = await(client.sendRequest(get(format("http://%s:%d/admin/metrics", host, port)).build()));
return response.bodyAs(UTF_8);
}
use of com.hotels.styx.client.StyxHttpClient 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));
}
Aggregations