use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class UmaClientFactory method createTokenService.
public UmaTokenService createTokenService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyClient client = ((ResteasyClientBuilder) ResteasyClientBuilder.newBuilder()).httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(metadata.getTokenEndpoint()));
UmaTokenService proxy = target.proxy(UmaTokenService.class);
return proxy;
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class UmaClientFactory method createPermissionService.
public UmaPermissionService createPermissionService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyClient client = ((ResteasyClientBuilder) ResteasyClientBuilder.newBuilder()).httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(metadata.getPermissionEndpoint()));
UmaPermissionService proxy = target.proxy(UmaPermissionService.class);
return proxy;
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class ClientFactory method createIntrospectionService.
public IntrospectionService createIntrospectionService(String p_url, ClientHttpEngine engine) {
ResteasyClient client = ((ResteasyClientBuilder) ResteasyClientBuilder.newBuilder()).httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(p_url));
IntrospectionService proxy = target.proxy(IntrospectionService.class);
return proxy;
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project java by wavefrontHQ.
the class HttpClientTest method httpClientTimeoutsWork.
@Test(expected = ProcessingException.class)
public void httpClientTimeoutsWork() throws Exception {
ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
factory.registerProvider(JsonNodeWriter.class);
factory.registerProvider(ResteasyJackson2Provider.class);
HttpClient httpClient = HttpClientBuilder.create().useSystemProperties().setMaxConnTotal(200).setMaxConnPerRoute(100).setConnectionTimeToLive(1, TimeUnit.MINUTES).setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(100).build()).setDefaultRequestConfig(RequestConfig.custom().setContentCompressionEnabled(true).setRedirectsEnabled(true).setConnectTimeout(5000).setConnectionRequestTimeout(5000).setSocketTimeout(60000).build()).setSSLSocketFactory(new LayeredConnectionSocketFactory() {
@Override
public Socket createLayeredSocket(Socket socket, String target, int port, HttpContext context) throws IOException, UnknownHostException {
return SSLConnectionSocketFactory.getSystemSocketFactory().createLayeredSocket(socket, target, port, context);
}
@Override
public Socket createSocket(HttpContext context) throws IOException {
return SSLConnectionSocketFactory.getSystemSocketFactory().createSocket(context);
}
@Override
public Socket connectSocket(int connectTimeout, Socket sock, HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpContext context) throws IOException {
assertTrue("Non-zero timeout passed to connect socket is expected", connectTimeout > 0);
throw new ProcessingException("OK");
}
}).build();
ResteasyClient client = new ResteasyClientBuilder().httpEngine(new ApacheHttpClient4Engine(httpClient, true)).providerFactory(factory).build();
SocketServerRunnable sr = new SocketServerRunnable();
Thread serverThread = new Thread(sr);
serverThread.start();
ResteasyWebTarget target = client.target("https://localhost:" + sr.getPort());
SimpleRESTEasyAPI proxy = target.proxy(SimpleRESTEasyAPI.class);
proxy.search("resteasy");
}
Aggregations