本文整理汇总了Java中io.dropwizard.client.JerseyClientConfiguration.setConnectionTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java JerseyClientConfiguration.setConnectionTimeout方法的具体用法?Java JerseyClientConfiguration.setConnectionTimeout怎么用?Java JerseyClientConfiguration.setConnectionTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.dropwizard.client.JerseyClientConfiguration
的用法示例。
在下文中一共展示了JerseyClientConfiguration.setConnectionTimeout方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNewSecureClient
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
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());
}
示例2: getDefaultJerseyClientConfiguration
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
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;
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:19,代码来源:MatchingServiceAdapterConfiguration.java
示例3: createClient
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void createClient() {
final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
configuration.setTimeout(Duration.minutes(1L));
configuration.setConnectionTimeout(Duration.minutes(1L));
configuration.setConnectionRequestTimeout(Duration.minutes(1L));
this.client = new JerseyClientBuilder(this.RULE.getEnvironment()).using(configuration)
.build("test client");
assertThat(this.client
.target(String.format(CREDENTIAL_END_POINT, this.RULE.getLocalPort()))
.request()
.header(X_AUTH_RSA_HEADER, BASE_64_PUBLIC_KEY)
.post(Entity.json(this.credential)).getStatus())
.isEqualTo(Status.CREATED.getStatusCode());
}
示例4: setUp
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(10));
jerseyClientConfiguration.setTimeout(Duration.seconds(10));
client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment())
.using(jerseyClientConfiguration)
.build(HubMetadataIntegrationTests.class.getName());
DateTimeFreezer.freezeTime();
}
示例5: setupClass
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() {
// We need to enable typing otherwise abstract types, e.g. ExpressionItem, won't be deserialisable.
RULE.getEnvironment().getObjectMapper().enableDefaultTyping();
app = RULE.getApplication();
JerseyClientConfiguration clientConfiguration = new JerseyClientConfiguration();
clientConfiguration.setConnectionRequestTimeout(io.dropwizard.util.Duration.seconds(10));
clientConfiguration.setConnectionTimeout(io.dropwizard.util.Duration.seconds(10));
clientConfiguration.setTimeout(Duration.seconds(10));
client = new JerseyClientBuilder(RULE.getEnvironment())
.using(clientConfiguration)
.build("test client");
APPLICATION_PORT = RULE.getLocalPort();
ADMIN_PORT = RULE.getAdminPort();
// STATISTICS_URL = String.format("http://localhost:%d/statistics", APPLICATION_PORT);
QUERY_SEARCH_URL = String.format("http://localhost:%d" +
ResourcePaths.ROOT_PATH +
ResourcePaths.STROOM_STATS +
ResourcePaths.V2 +
QueryResource.SEARCH_ENDPOINT, APPLICATION_PORT);
BASE_TASKS_URL = String.format("http://localhost:%d/tasks/", ADMIN_PORT);
HEALTH_CHECKS_URL = String.format("http://localhost:%d/admin/healthcheck?pretty=true", ADMIN_PORT);
START_PROCESSING_URL = BASE_TASKS_URL + "startProcessing";
STOP_PROCESSING_URL = BASE_TASKS_URL + "stopProcessing";
LOGGER.info("Query url: {}", QUERY_SEARCH_URL);
LOGGER.info("Health checks url: {}", HEALTH_CHECKS_URL);
LOGGER.info("Start processing url: {}, e.g. curl -X POST {}", START_PROCESSING_URL, START_PROCESSING_URL);
LOGGER.info("Stop processing url: {}, e.g. curl -X POST {}", STOP_PROCESSING_URL, STOP_PROCESSING_URL);
}
示例6: buildClient
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
private static Client buildClient(JerseyClientBuilder clientBuilder) {
final JerseyClientConfiguration jerseyConfig = new JerseyClientConfiguration();
jerseyConfig.setConnectionTimeout(Duration.milliseconds(500));
jerseyConfig.setKeepAlive(Duration.minutes(5));
jerseyConfig.setMaxConnections(2048);
jerseyConfig.setMaxConnectionsPerRoute(2048);
jerseyConfig.setTimeout(Duration.hours(1));
jerseyConfig.setTimeToLive(Duration.minutes(5));
final JerseyClientBuilder builder = clientBuilder != null ? clientBuilder : new JerseyClientBuilder(new MetricRegistry());
return builder
.using(Executors.newSingleThreadExecutor(), new ObjectMapper())
.using(jerseyConfig).build("SECPClient");
}
示例7: setup
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
configuration.setTimeout(Duration.minutes(1L));
configuration.setConnectionTimeout(Duration.minutes(1L));
this.client = new CredentialStorageServiceClient(
new File("./src/test/resources/private_key.der"),
new File("./src/test/resources/public_key.der"),
String.format("http://localhost:%d/", this.RULE.getLocalPort()),
configuration);
}
开发者ID:mtakaki,项目名称:CredentialStorageServiceClient,代码行数:13,代码来源:CredentialStorageServiceClientIntegrationTest.java
示例8: createClient
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void createClient() {
final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
configuration.setTimeout(Duration.minutes(1L));
configuration.setConnectionTimeout(Duration.minutes(1L));
configuration.setConnectionRequestTimeout(Duration.minutes(1L));
this.client = new JerseyClientBuilder(this.RULE.getEnvironment()).using(configuration)
.build("test client");
}
示例9: setupClient
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void setupClient() {
final JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
jerseyClientConfiguration.setConnectionTimeout(Duration.minutes(1L));
jerseyClientConfiguration.setConnectionRequestTimeout(Duration.minutes(1L));
jerseyClientConfiguration.setTimeout(Duration.minutes(1L));
client = new JerseyClientBuilder(this.RULE.getEnvironment())
.using(jerseyClientConfiguration)
.withProperty(ClientProperties.FOLLOW_REDIRECTS, Boolean.FALSE)
.build("test client");
}
示例10: setup
import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void setup() {
clientConfiguration = new JerseyClientConfiguration();
clientConfiguration.setConnectionTimeout(Duration.milliseconds(100));
tenacityConfiguration = new TenacityConfiguration();
metricRegistry = new MetricRegistry();
executorService = Executors.newSingleThreadExecutor();
}