use of org.apache.cxf.transport.http.URLConnectionHTTPConduit in project cxf by apache.
the class HttpConduitConfigApplierTest method testTrustVerificationEnabled.
@Test
public void testTrustVerificationEnabled() throws IOException {
HttpConduitConfigApplier configApplier = new HttpConduitConfigApplier();
Dictionary<String, String> configValues = new Hashtable<>();
configValues.put("tlsClientParameters.disableCNCheck", "true");
configValues.put("tlsClientParameters.trustManagers.disableTrustVerification", "false");
String address = "https://localhost:12345";
Bus bus = new ExtensionManagerBus();
EndpointInfo ei = new EndpointInfo();
ei.setAddress(address);
HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
configApplier.apply(configValues, conduit, address);
assertNotNull(conduit.getTlsClientParameters().getTrustManagers());
assertEquals(conduit.getTlsClientParameters().getTrustManagers().length, 1);
assertFalse(conduit.getTlsClientParameters().getTrustManagers()[0].getClass().getName().startsWith(InsecureTrustManager.class.getName()));
assertTrue(conduit.getTlsClientParameters().isDisableCNCheck());
}
use of org.apache.cxf.transport.http.URLConnectionHTTPConduit in project cxf by apache.
the class HttpConduitConfigApplierTest method testNormalTrustLoading.
@Test
public void testNormalTrustLoading() throws IOException {
HttpConduitConfigApplier configApplier = new HttpConduitConfigApplier();
Dictionary<String, String> configValues = new Hashtable<>();
configValues.put("tlsClientParameters.disableCNCheck", "false");
String address = "https://localhost:12345";
Bus bus = new ExtensionManagerBus();
EndpointInfo ei = new EndpointInfo();
ei.setAddress(address);
HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
configApplier.apply(configValues, conduit, address);
assertNull(conduit.getTlsClientParameters().getTrustManagers());
assertFalse(conduit.getTlsClientParameters().isDisableCNCheck());
}
use of org.apache.cxf.transport.http.URLConnectionHTTPConduit in project cxf by apache.
the class HttpConduitConfigApplierTest method testDisableTrustVerification.
@Test
public void testDisableTrustVerification() throws IOException {
HttpConduitConfigApplier configApplier = new HttpConduitConfigApplier();
Dictionary<String, String> configValues = new Hashtable<>();
configValues.put("tlsClientParameters.disableCNCheck", "true");
configValues.put("tlsClientParameters.trustManagers.disableTrustVerification", "true");
String address = "https://localhost:12345";
Bus bus = new ExtensionManagerBus();
EndpointInfo ei = new EndpointInfo();
ei.setAddress(address);
HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
configApplier.apply(configValues, conduit, address);
assertNotNull(conduit.getTlsClientParameters().getTrustManagers());
assertEquals(conduit.getTlsClientParameters().getTrustManagers().length, 1);
assertTrue(conduit.getTlsClientParameters().getTrustManagers()[0].getClass().getName().startsWith(InsecureTrustManager.class.getName()));
assertTrue(conduit.getTlsClientParameters().isDisableCNCheck());
}
Aggregations