Java 类io.dropwizard.client.ssl.TlsConfiguration 实例源码

项目:dropwizard-auth-example    文件:IntegrationTest.java   
protected Client getNewSecureClient(String keyStoreResourcePath) throws Exception {
    TlsConfiguration tlsConfiguration = new TlsConfiguration();
    tlsConfiguration.setKeyStorePath(new File(resourceFilePath(keyStoreResourcePath)));
    tlsConfiguration.setKeyStorePassword("notsecret");

    tlsConfiguration.setTrustStorePath(new File(resourceFilePath("tls/test-truststore.jks")));
    tlsConfiguration.setTrustStorePassword("notsecret");

    tlsConfiguration.setVerifyHostname(false);

    tlsConfiguration.setSupportedCiphers(Lists.newArrayList("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"));
    tlsConfiguration.setSupportedProtocols(Lists.newArrayList("TLSv1.2"));

    JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTlsConfiguration(tlsConfiguration);
    configuration.setTimeout(Duration.seconds(30));
    configuration.setConnectionTimeout(Duration.seconds(30));
    configuration.setConnectionRequestTimeout(Duration.seconds(30));

    return new JerseyClientBuilder(USER_INFO_APP_RULE.getEnvironment())
            .using(configuration)
            .build(UUID.randomUUID().toString());
}
项目:verify-matching-service-adapter    文件:MatchingServiceAdapterConfiguration.java   
public static JerseyClientConfiguration getDefaultJerseyClientConfiguration(boolean verifyHostname, boolean trustSelfSignedCertificates) {
    JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
    jerseyClientConfiguration.setTimeout(Duration.seconds(60));
    jerseyClientConfiguration.setTimeToLive(Duration.minutes(10));
    jerseyClientConfiguration.setCookiesEnabled(false);
    jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(4));
    jerseyClientConfiguration.setRetries(3);
    jerseyClientConfiguration.setKeepAlive(Duration.seconds(60));
    jerseyClientConfiguration.setChunkedEncodingEnabled(false);
    jerseyClientConfiguration.setValidateAfterInactivityPeriod(Duration.seconds(5));
    TlsConfiguration tlsConfiguration = new TlsConfiguration();
    tlsConfiguration.setProtocol("TLSv1.2");
    tlsConfiguration.setVerifyHostname(verifyHostname);
    tlsConfiguration.setTrustSelfSignedCertificates(trustSelfSignedCertificates);
    jerseyClientConfiguration.setTlsConfiguration(tlsConfiguration);
    jerseyClientConfiguration.setGzipEnabledForRequests(false);
    return jerseyClientConfiguration;
}