Search in sources :

Example 46 with Greeter

use of org.apache.hello_world.Greeter in project cxf by apache.

the class CipherSuitesTest method testRC4IncludedAsync.

// Both client + server include RC4
@org.junit.Test
public void testRC4IncludedAsync() throws Exception {
    String version = System.getProperty("java.version");
    if (version.length() > 1 && 1.8D <= Double.parseDouble(version.substring(0, 3)) || version.length() == 1 && 9 <= Integer.parseInt(version.substring(0, 1))) {
        // RC4 not supported since JDK8
        return;
    }
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = CipherSuitesTest.class.getResource("ciphersuites-rc4-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    // Enable Async
    ((BindingProvider) port).getRequestContext().put("use.async.http.conduit", true);
    updateAddressPort(port, PORT2);
    assertEquals(port.greetMe("Kitty"), "Hello Kitty");
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL)

Example 47 with Greeter

use of org.apache.hello_world.Greeter in project cxf by apache.

the class CipherSuitesTest method testClientAESServerRC4Included.

// Client only includes AES, server only includes RC4
@org.junit.Test
public void testClientAESServerRC4Included() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    updateAddressPort(port, PORT2);
    try {
        port.greetMe("Kitty");
        fail("Failure expected on not being able to negotiate a cipher suite");
    } catch (Exception ex) {
    // expected
    }
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL) CertificateException(java.security.cert.CertificateException)

Example 48 with Greeter

use of org.apache.hello_world.Greeter in project cxf by apache.

the class CipherSuitesTest method testAESIncluded.

// Both client + server include AES
@org.junit.Test
public void testAESIncluded() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    updateAddressPort(port, PORT);
    assertEquals(port.greetMe("Kitty"), "Hello Kitty");
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL)

Example 49 with Greeter

use of org.apache.hello_world.Greeter in project cxf by apache.

the class CipherSuitesTest method testAESIncludedAsync.

// Both client + server include AES
@org.junit.Test
public void testAESIncludedAsync() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    // Enable Async
    ((BindingProvider) port).getRequestContext().put("use.async.http.conduit", true);
    updateAddressPort(port, PORT);
    assertEquals(port.greetMe("Kitty"), "Hello Kitty");
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL)

Example 50 with Greeter

use of org.apache.hello_world.Greeter in project cxf by apache.

the class CipherSuitesTest method testClientRC4ServerAESIncluded.

// Client only includes RC4, server only includes AES
@org.junit.Test
public void testClientRC4ServerAESIncluded() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = CipherSuitesTest.class.getResource("ciphersuites-rc4-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    updateAddressPort(port, PORT);
    try {
        port.greetMe("Kitty");
        fail("Failure expected on not being able to negotiate a cipher suite");
    } catch (Exception ex) {
    // expected
    }
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL) CertificateException(java.security.cert.CertificateException)

Aggregations

Greeter (org.apache.hello_world.Greeter)63 URL (java.net.URL)57 SOAPService (org.apache.hello_world.services.SOAPService)57 Bus (org.apache.cxf.Bus)42 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)40 Test (org.junit.Test)19 Client (org.apache.cxf.endpoint.Client)14 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)14 CertificateException (java.security.cert.CertificateException)9 TLSClientParameters (org.apache.cxf.configuration.jsse.TLSClientParameters)8 TrustManager (javax.net.ssl.TrustManager)7 X509TrustManager (javax.net.ssl.X509TrustManager)7 IOException (java.io.IOException)5 HTTPClientPolicy (org.apache.cxf.transports.http.configuration.HTTPClientPolicy)5 AuthorizationPolicy (org.apache.cxf.configuration.security.AuthorizationPolicy)4 GeneralSecurityException (java.security.GeneralSecurityException)3 BindingProvider (javax.xml.ws.BindingProvider)3 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)3 UntrustedURLConnectionIOException (org.apache.cxf.transport.http.UntrustedURLConnectionIOException)3 MalformedURLException (java.net.MalformedURLException)2