Search in sources :

Example 41 with HTTPConduit

use of org.apache.cxf.transport.http.HTTPConduit in project cxf by apache.

the class AsyncHttpTransportFactory method getConduit.

@Override
public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target, Bus bus) throws IOException {
    // need to updated the endpointInfo
    endpointInfo.setAddress(getAddress(endpointInfo));
    AsyncHTTPConduitFactory fact = bus.getExtension(AsyncHTTPConduitFactory.class);
    if (fact == null) {
        fact = factory;
    }
    HTTPConduit conduit = fact.createConduit(bus, endpointInfo, target);
    // Spring configure the conduit.
    String address = conduit.getAddress();
    if (address != null && address.indexOf('?') != -1) {
        address = address.substring(0, address.indexOf('?'));
    }
    HTTPConduitConfigurer c1 = bus.getExtension(HTTPConduitConfigurer.class);
    if (c1 != null) {
        c1.configure(conduit.getBeanName(), address, conduit);
    }
    configure(bus, conduit, conduit.getBeanName(), address);
    conduit.finalizeConfig();
    return conduit;
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) HTTPConduitConfigurer(org.apache.cxf.transport.http.HTTPConduitConfigurer)

Example 42 with HTTPConduit

use of org.apache.cxf.transport.http.HTTPConduit in project cxf by apache.

the class AsyncHTTPConduitTest method testResponseSameBufferSize.

@Test
public void testResponseSameBufferSize() throws Exception {
    updateAddressPort(g, PORT);
    HTTPConduit c = (HTTPConduit) ClientProxy.getClient(g).getConduit();
    c.getClient().setReceiveTimeout(12000);
    try {
        g.greetMe(FILL_BUFFER);
        g.greetMe("Hello");
    } catch (Exception ex) {
        fail();
    }
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 43 with HTTPConduit

use of org.apache.cxf.transport.http.HTTPConduit in project cxf by apache.

the class AsyncHTTPConduitTest method testTimeoutAsync.

@Test
public void testTimeoutAsync() throws Exception {
    updateAddressPort(g, PORT);
    HTTPConduit c = (HTTPConduit) ClientProxy.getClient(g).getConduit();
    c.getClient().setReceiveTimeout(3000);
    try {
        Response<GreetMeLaterResponse> future = g.greetMeLaterAsync(-5000L);
        future.get();
        fail();
    } catch (Exception ex) {
    // expected!!!
    }
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) GreetMeLaterResponse(org.apache.hello_world_soap_http.types.GreetMeLaterResponse) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 44 with HTTPConduit

use of org.apache.cxf.transport.http.HTTPConduit in project cxf by apache.

the class AsyncHTTPConduitTest method testTimeout.

@Test
public void testTimeout() throws Exception {
    updateAddressPort(g, PORT);
    HTTPConduit c = (HTTPConduit) ClientProxy.getClient(g).getConduit();
    c.getClient().setReceiveTimeout(3000);
    try {
        assertEquals("Hello " + request, g.greetMeLater(-5000));
        fail();
    } catch (Exception ex) {
    // expected!!!
    }
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 45 with HTTPConduit

use of org.apache.cxf.transport.http.HTTPConduit in project cxf by apache.

the class AsyncHTTPConduitTest method testTimeout.

@Test
public void testTimeout() throws Exception {
    updateAddressPort(g, PORT);
    HTTPConduit c = (HTTPConduit) ClientProxy.getClient(g).getConduit();
    c.getClient().setReceiveTimeout(3000);
    try {
        assertEquals("Hello " + request, g.greetMeLater(-5000));
        fail();
    } catch (Exception ex) {
    // expected!!!
    }
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Aggregations

HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)158 Client (org.apache.cxf.endpoint.Client)65 Test (org.junit.Test)60 HTTPClientPolicy (org.apache.cxf.transports.http.configuration.HTTPClientPolicy)52 URL (java.net.URL)43 TLSClientParameters (org.apache.cxf.configuration.jsse.TLSClientParameters)43 Bus (org.apache.cxf.Bus)36 QName (javax.xml.namespace.QName)24 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)23 KeyStore (java.security.KeyStore)21 Greeter (org.apache.hello_world.Greeter)21 SOAPService (org.apache.hello_world.services.SOAPService)21 Service (javax.xml.ws.Service)18 TrustManagerFactory (javax.net.ssl.TrustManagerFactory)17 InputStream (java.io.InputStream)15 AuthorizationPolicy (org.apache.cxf.configuration.security.AuthorizationPolicy)15 IOException (java.io.IOException)13 ExecutionException (java.util.concurrent.ExecutionException)13 TrustManager (javax.net.ssl.TrustManager)13 WebClient (org.apache.cxf.jaxrs.client.WebClient)11