use of org.glassfish.jersey.client.JerseyClientBuilder in project dropwizard by dropwizard.
the class Http2IntegrationTest method testHttp11.
@Test
public void testHttp11() throws Exception {
final String hostname = "localhost";
final int port = appRule.getLocalPort();
final JerseyClient http11Client = new JerseyClientBuilder().sslContext(sslContextFactory.getSslContext()).build();
final Response response = http11Client.target("https://" + hostname + ":" + port + "/api/test").request().get();
assertThat(response.getHeaderString(HttpHeaders.CONTENT_TYPE)).isEqualTo(MediaType.APPLICATION_JSON);
assertThat(response.readEntity(String.class)).isEqualTo(FakeApplication.HELLO_WORLD);
http11Client.close();
}
use of org.glassfish.jersey.client.JerseyClientBuilder in project perry by ca-cwds.
the class PerryRealm method onInit.
@Override
protected void onInit() {
super.onInit();
JerseyClientBuilder clientBuilder = new JerseyClientBuilder().property(ClientProperties.CONNECT_TIMEOUT, 5000).property(ClientProperties.READ_TIMEOUT, 20000);
client = clientBuilder.build();
}
use of org.glassfish.jersey.client.JerseyClientBuilder in project api-core by ca-cwds.
the class TokenResource method getClient.
private synchronized Client getClient() {
if (client == null) {
JerseyClientBuilder clientBuilder = new JerseyClientBuilder().property(ClientProperties.CONNECT_TIMEOUT, 5000).property(ClientProperties.READ_TIMEOUT, 30000).hostnameVerifier((hostName, sslSession) -> true);
this.client = clientBuilder.build();
}
return client;
}
use of org.glassfish.jersey.client.JerseyClientBuilder in project athenz by yahoo.
the class ZTSClientTimeoutTest method testZTSClientReadTimeoutForJerseyContainer.
@Test
public void testZTSClientReadTimeoutForJerseyContainer() throws Exception {
ZTSClientMock.setClientBuilder(new JerseyClientBuilder());
server = new JettyServer(port);
server.start();
String baseUri = "http://localhost:" + port;
ZTSClientMock ztsClient = new ZTSClientMock(baseUri);
try {
ztsClient.getRoleAccess("testDomain", "testPrincipal");
fail("read timeout not set");
} catch (ZTSClientException expected) {
assertEquals(expected.code, ResourceException.BAD_REQUEST);
assertEquals(expected.getMessage(), "ResourceException (400): java.net.SocketTimeoutException: Read timed out");
}
ztsClient.close();
ZTSClientMock.setClientBuilder(null);
}
use of org.glassfish.jersey.client.JerseyClientBuilder in project athenz by yahoo.
the class ZMSClientTimeoutTest method testZMSClientReadTimeoutForJerseyContainer.
@Test
public void testZMSClientReadTimeoutForJerseyContainer() throws Exception {
ZMSClientExt.setClientBuilder(new JerseyClientBuilder());
server = new JettyServer(port);
server.start();
String baseUri = "http://localhost:" + port;
ZMSClientExt zmsClient = new ZMSClientExt(baseUri);
try {
zmsClient.getDomain("test");
fail("read timeout not set");
} catch (ZMSClientException expected) {
assertEquals(expected.code, ResourceException.BAD_REQUEST);
assertEquals(expected.getMessage(), "ResourceException (400): java.net.SocketTimeoutException: Read timed out");
}
zmsClient.close();
ZMSClientExt.setClientBuilder(null);
}
Aggregations