Search in sources :

Example 1 with HttpProducer

use of org.apache.camel.component.http.HttpProducer in project camel by apache.

the class JettyHttpClientOptionsTest method testCustomHttpBinding.

@Test
public void testCustomHttpBinding() throws Exception {
    // assert jetty was configured with our timeout
    HttpCommonEndpoint jettyEndpoint = context.getEndpoint("http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=5555", HttpCommonEndpoint.class);
    assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
    HttpProducer producer = (HttpProducer) jettyEndpoint.createProducer();
    assertEquals("Get the wrong http client parameter", 5555, producer.getHttpClient().getParams().getSoTimeout());
    // send and receive
    Object out = template.requestBody("http://localhost:{{port}}/myapp/myservice", "Hello World");
    assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, out));
}
Also used : HttpCommonEndpoint(org.apache.camel.http.common.HttpCommonEndpoint) HttpProducer(org.apache.camel.component.http.HttpProducer) Test(org.junit.Test)

Aggregations

HttpProducer (org.apache.camel.component.http.HttpProducer)1 HttpCommonEndpoint (org.apache.camel.http.common.HttpCommonEndpoint)1 Test (org.junit.Test)1