use of org.glassfish.jersey.SslConfigurator in project jersey by jersey.
the class MainTest method _testSSLWithBasicAndSSLAuth.
/**
* Test to see that the correct Http status is returned.
*/
private void _testSSLWithBasicAndSSLAuth(ClientConfig clientConfig) {
SslConfigurator sslConfig = SslConfigurator.newInstance().trustStoreFile(TRUSTORE_CLIENT_FILE).trustStorePassword(TRUSTSTORE_CLIENT_PWD).keyStoreFile(KEYSTORE_CLIENT_FILE).keyPassword(KEYSTORE_CLIENT_PWD);
final SSLContext sslContext = sslConfig.createSSLContext();
Client client = ClientBuilder.newBuilder().withConfig(clientConfig).sslContext(sslContext).build();
// client basic auth demonstration
client.register(HttpAuthenticationFeature.basic("user", "password"));
System.out.println("Client: GET " + Server.BASE_URI);
WebTarget target = client.target(Server.BASE_URI);
final Response response = target.path("/").request().get(Response.class);
assertEquals(200, response.getStatus());
}
Aggregations