use of org.apache.http.impl.conn.PoolingClientConnectionManager in project wildfly by wildfly.
the class BeanValidationCdiIntegrationTestCase method testInvalidRequest.
@Test
public void testInvalidRequest() throws Exception {
DefaultHttpClient client = new DefaultHttpClient(new PoolingClientConnectionManager());
HttpGet get = new HttpGet(url + "myjaxrs/order/11");
HttpResponse result = client.execute(get);
result = client.execute(get);
Assert.assertEquals("Parameter constraint violated", 400, result.getStatusLine().getStatusCode());
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project oxCore by GluuFederation.
the class SslDefaultHttpClient method createClientConnectionManager.
@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
// Register for port 443 our SSLSocketFactory with our keystore to the ConnectionManager
registry.register(new Scheme("https", 443, newSslSocketFactory()));
return new PoolingClientConnectionManager(registry);
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project oxAuth by GluuFederation.
the class Utils method createHttpClientTrustAll.
public static HttpClient createHttpClientTrustAll() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
return true;
}
}, new X509HostnameVerifier() {
@Override
public void verify(String host, SSLSocket ssl) throws IOException {
}
@Override
public void verify(String host, X509Certificate cert) throws SSLException {
}
@Override
public void verify(String host, String[] cns, String[] subjectAlts) throws SSLException {
}
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
registry.register(new Scheme("https", 443, sf));
ClientConnectionManager ccm = new PoolingClientConnectionManager(registry);
return new DefaultHttpClient(ccm);
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project oxAuth by GluuFederation.
the class HttpService method getHttpsClientDefaulTrustStore.
@Deprecated
public HttpClient getHttpsClientDefaulTrustStore() {
try {
PlainSocketFactory psf = PlainSocketFactory.getSocketFactory();
SSLContext ctx = SSLContext.getInstance("TLS");
SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", 80, psf));
registry.register(new Scheme("https", 443, ssf));
ClientConnectionManager ccm = new PoolingClientConnectionManager(registry);
return new DefaultHttpClient(ccm);
} catch (Exception ex) {
log.error("Failed to create https client", ex);
return new DefaultHttpClient();
}
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project oxAuth by GluuFederation.
the class BaseTest method createHttpClientTrustAll.
public static HttpClient createHttpClientTrustAll() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
return true;
}
}, new AllowAllHostnameVerifier());
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
registry.register(new Scheme("https", 443, sf));
ClientConnectionManager ccm = new PoolingClientConnectionManager(registry);
return new DefaultHttpClient(ccm);
}
Aggregations