http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
new file mode 100644
index 0000000..378f77c
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.net.URISyntaxException;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.util.jsse.KeyManagersParameters;
+import org.apache.camel.util.jsse.KeyStoreParameters;
+import org.apache.camel.util.jsse.SSLContextParameters;
+
+public class HttpsRouteSslContextParametersInComponentTest extends 
HttpsRouteTest {
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws URISyntaxException {
+                JettyHttpComponent jetty = getContext().getComponent("jetty", 
JettyHttpComponent.class);
+                
+                KeyStoreParameters ksp = new KeyStoreParameters();
+                
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
+                ksp.setPassword(pwd);
+                
+                KeyManagersParameters kmp = new KeyManagersParameters();
+                kmp.setKeyPassword(pwd);
+                kmp.setKeyStore(ksp);
+                
+                SSLContextParameters sslContextParameters = new 
SSLContextParameters();
+                sslContextParameters.setKeyManagers(kmp);
+                jetty.setSslContextParameters(sslContextParameters);
+                // NOTE: These are here to check that they are properly 
ignored.
+                setSSLProps(jetty, "", "asdfasdfasdfdasfs", "sadfasdfasdfas");
+
+                from("jetty:https://localhost:"; + port1 + 
"/test").to("mock:a");
+
+                Processor proc = new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        exchange.getOut().setBody("<b>Hello World</b>");
+                    }
+                };
+                from("jetty:https://localhost:"; + port1 + 
"/hello").process(proc);
+
+                from("jetty:https://localhost:"; + port2 + 
"/test").to("mock:b");
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
new file mode 100644
index 0000000..43c8349
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.net.URISyntaxException;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.util.jsse.KeyManagersParameters;
+import org.apache.camel.util.jsse.KeyStoreParameters;
+import org.apache.camel.util.jsse.SSLContextParameters;
+
+public class HttpsRouteSslContextParametersInUriTest extends HttpsRouteTest {
+    
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        KeyStoreParameters ksp = new KeyStoreParameters();
+        
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
+        ksp.setPassword(pwd);
+
+        KeyManagersParameters kmp = new KeyManagersParameters();
+        kmp.setKeyPassword(pwd);
+        kmp.setKeyStore(ksp);
+
+        SSLContextParameters sslContextParameters = new SSLContextParameters();
+        sslContextParameters.setKeyManagers(kmp);
+
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("sslContextParameters", sslContextParameters);
+
+        return registry;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws URISyntaxException {
+                JettyHttpComponent jetty = getContext().getComponent("jetty", 
JettyHttpComponent.class);
+                // NOTE: These are here to check that they are properly 
ignored.
+                setSSLProps(jetty, "", "asdfasdfasdfdasfs", "sadfasdfasdfas");
+
+                from("jetty:https://localhost:"; + port1 + 
"/test?sslContextParametersRef=sslContextParameters").to("mock:a");
+
+                Processor proc = new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        exchange.getOut().setBody("<b>Hello World</b>");
+                    }
+                };
+                from("jetty:https://localhost:"; + port1 + 
"/hello?sslContextParametersRef=sslContextParameters").process(proc);
+
+                from("jetty:https://localhost:"; + port2 + 
"/test?sslContextParametersRef=sslContextParameters").to("mock:b");
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
new file mode 100644
index 0000000..56cf84b
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
@@ -0,0 +1,210 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.SocketException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class HttpsRouteTest extends BaseJettyTest {
+
+    private static final String NULL_VALUE_MARKER = 
CamelTestSupport.class.getCanonicalName();
+
+    protected String expectedBody = "<hello>world!</hello>";
+    protected String pwd = "changeit";
+    protected Properties originalValues = new Properties();
+    protected int port1;
+    protected int port2;
+
+    public String getHttpProducerScheme() {
+        return "https://";;
+    }
+    
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        port1 = getNextPort();
+        port2 = getNextPort(port1 + 1);
+        
+        super.setUp();
+        // ensure jsse clients can validate the self signed dummy localhost 
cert, 
+        // use the server keystore as the trust store for these tests
+        URL trustStoreUrl = 
this.getClass().getClassLoader().getResource("jsse/localhost.ks");
+        setSystemProp("javax.net.ssl.trustStore", 
trustStoreUrl.toURI().getPath());
+    }
+
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        restoreSystemProperties();
+        super.tearDown();
+    }
+
+    protected void setSystemProp(String key, String value) {
+        String originalValue = System.setProperty(key, value);
+        originalValues.put(key, originalValue != null ? originalValue : 
NULL_VALUE_MARKER);
+    }
+
+    protected void restoreSystemProperties() {
+        for (Object key : originalValues.keySet()) {
+            Object value = originalValues.get(key);
+            if (NULL_VALUE_MARKER.equals(value)) {
+                System.getProperties().remove(key);    
+            } else {
+                System.setProperty((String)key, (String)value);
+            }
+        }
+    }
+
+    @Test
+    public void testEndpoint() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mockEndpointA = resolveMandatoryEndpoint("mock:a", 
MockEndpoint.class);
+        mockEndpointA.expectedBodiesReceived(expectedBody);
+        MockEndpoint mockEndpointB = resolveMandatoryEndpoint("mock:b", 
MockEndpoint.class);
+        mockEndpointB.expectedBodiesReceived(expectedBody);
+
+        invokeHttpEndpoint();
+
+        mockEndpointA.assertIsSatisfied();
+        mockEndpointB.assertIsSatisfied();
+        List<Exchange> list = mockEndpointA.getReceivedExchanges();
+        Exchange exchange = list.get(0);
+        assertNotNull("exchange", exchange);
+
+        Message in = exchange.getIn();
+        assertNotNull("in", in);
+
+        Map<String, Object> headers = in.getHeaders();
+
+        log.info("Headers: " + headers);
+
+        assertTrue("Should be more than one header but was: " + headers, 
headers.size() > 0);
+    }
+    
+    @Test
+    public void testEndpointWithoutHttps() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:a", 
MockEndpoint.class);
+        try {
+            template.sendBodyAndHeader("http://localhost:"; + port1 + "/test", 
expectedBody, "Content-Type", "application/xml");
+            fail("expect exception on access to https endpoint via http");
+        } catch (RuntimeCamelException expected) {
+        }
+        assertTrue("mock endpoint was not called", 
mockEndpoint.getExchanges().isEmpty());
+    }
+
+    @Test
+    public void testHelloEndpoint() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        InputStream is = new URL("https://localhost:"; + port1 + 
"/hello").openStream();
+        int c;
+        while ((c = is.read()) >= 0) {
+            os.write(c);
+        }
+
+        String data = new String(os.toByteArray());
+        assertEquals("<b>Hello World</b>", data);
+    }
+    
+    @Test
+    public void testHelloEndpointWithoutHttps() throws Exception {
+        // these tests does not run well on Windows
+        if (isPlatform("windows")) {
+            return;
+        }
+
+        try {
+            new URL("http://localhost:"; + port1 + "/hello").openStream();
+            fail("expected SocketException on use ot http");
+        } catch (SocketException expected) {
+        }
+    }
+    
+    protected void invokeHttpEndpoint() throws IOException {
+        template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + 
port1 + "/test", expectedBody, "Content-Type", "application/xml");
+        template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + 
port2 + "/test", expectedBody, "Content-Type", "application/xml");
+    }
+    
+    protected void configureSslContextFactory(SslContextFactory 
sslContextFactory) {
+        sslContextFactory.setKeyManagerPassword(pwd);
+        sslContextFactory.setKeyStorePassword(pwd);
+        URL keyStoreUrl = 
this.getClass().getClassLoader().getResource("jsse/localhost.ks");
+        try {
+            sslContextFactory.setKeyStorePath(keyStoreUrl.toURI().getPath());
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+        sslContextFactory.setTrustStoreType("JKS");
+    }
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws URISyntaxException {
+                JettyHttpComponent componentJetty = (JettyHttpComponent) 
context.getComponent("jetty");
+                componentJetty.setSslPassword(pwd);
+                componentJetty.setSslKeyPassword(pwd);
+                URL keyStoreUrl = 
this.getClass().getClassLoader().getResource("jsse/localhost.ks");
+                componentJetty.setKeystore(keyStoreUrl.toURI().getPath());
+                
+                from("jetty:https://localhost:"; + port1 + 
"/test").to("mock:a");
+
+                Processor proc = new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        exchange.getOut().setBody("<b>Hello World</b>");
+                    }
+                };
+                from("jetty:https://localhost:"; + port1 + 
"/hello").process(proc);
+                
+                from("jetty:https://localhost:"; + port2 + 
"/test").to("mock:b");
+            }
+        };
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java
new file mode 100644
index 0000000..b85bd61
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+public class HttpsRouteWithSslConnectorPropertiesTest extends HttpsRouteTest {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws URISyntaxException {
+                // START SNIPPET: e1
+                // keystore path
+                URL keyStoreUrl = 
this.getClass().getClassLoader().getResource("jsse/localhost.ks");
+                String path = keyStoreUrl.toURI().getPath();
+
+                JettyHttpComponent jetty = getContext().getComponent("jetty", 
JettyHttpComponent.class);
+                setSSLProps(jetty, path, pwd, pwd);
+                // END SNIPPET: e1
+
+                from("jetty:https://localhost:"; + port1 + 
"/test").to("mock:a");
+
+                Processor proc = new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        exchange.getOut().setBody("<b>Hello World</b>");
+                    }
+                };
+                from("jetty:https://localhost:"; + port1 + 
"/hello").process(proc);
+
+                from("jetty:https://localhost:"; + port2 + 
"/test").to("mock:b");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
new file mode 100644
index 0000000..d28af2f
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.IOException;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class InterfacesTest extends BaseJettyTest {
+    private static boolean isMacOS = 
System.getProperty("os.name").startsWith("Mac");
+    private String remoteInterfaceAddress;
+
+    private int port1;
+    private int port2;
+    private int port3;
+    private int port4;
+
+    public InterfacesTest() throws IOException {
+        // Retrieve an address of some remote network interface
+        Enumeration<NetworkInterface> interfaces =  
NetworkInterface.getNetworkInterfaces();
+        
+        while (remoteInterfaceAddress == null && interfaces.hasMoreElements()) 
{
+            NetworkInterface interfaze = interfaces.nextElement();
+            Enumeration<InetAddress> addresses =  interfaze.getInetAddresses();
+            if (addresses.hasMoreElements()) {
+                InetAddress nextAddress = addresses.nextElement();
+                if (nextAddress.isLoopbackAddress() || 
!nextAddress.isReachable(2000)) {
+                    continue;
+                }
+                if (nextAddress instanceof Inet6Address) {
+                    continue;
+                } else {
+                    remoteInterfaceAddress = nextAddress.getHostAddress();
+                }
+            }
+        }
+    }
+    
+    @Test
+    public void testLocalInterfaceHandled() throws IOException, 
InterruptedException {
+        int expectedMessages = (remoteInterfaceAddress != null) ? 3 : 2;
+        
getMockEndpoint("mock:endpoint").expectedMessageCount(expectedMessages);
+        
+        URL localUrl = new URL("http://localhost:"; + port1 + "/testRoute");
+        String localResponse = 
context.getTypeConverter().convertTo(String.class, localUrl.openStream());
+        assertEquals("local", localResponse);
+       
+        if (!isMacOS) {
+            localUrl = new URL("http://127.0.0.1:"; + port2 + "/testRoute");
+        } else {
+            localUrl = new URL("http://localhost:"; + port2 + "/testRoute");
+        }
+        localResponse = context.getTypeConverter().convertTo(String.class, 
localUrl.openStream());
+        assertEquals("local-differentPort", localResponse);
+        
+        if (remoteInterfaceAddress != null) {            
+            URL url = new URL("http://"; + remoteInterfaceAddress + ":" + port3 
+ "/testRoute");
+            String remoteResponse = 
context.getTypeConverter().convertTo(String.class, url.openStream());
+            assertEquals("remote", remoteResponse);
+        }
+        
+        assertMockEndpointsSatisfied();
+    }    
+      
+    @Test
+    public void testAllInterfaces() throws Exception {
+        int expectedMessages = (remoteInterfaceAddress != null) ? 2 : 1;
+        
getMockEndpoint("mock:endpoint").expectedMessageCount(expectedMessages);
+        
+        URL localUrl = new URL("http://localhost:"; + port4 + "/allInterfaces");
+        String localResponse = 
context.getTypeConverter().convertTo(String.class, localUrl.openStream());
+        assertEquals("allInterfaces", localResponse);
+        
+        if (remoteInterfaceAddress != null) {
+            URL url = new URL("http://"; + remoteInterfaceAddress + ":" + port4 
+ "/allInterfaces");
+            String remoteResponse = 
context.getTypeConverter().convertTo(String.class, url.openStream());
+            assertEquals("allInterfaces", remoteResponse);
+        }
+        
+        assertMockEndpointsSatisfied();
+    }
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+        
+            @Override
+            public void configure() throws Exception {
+                port1 = getNextPort();
+                port2 = getNextPort(port1 + 1);
+                port3 = getNextPort(port2 + 1);
+                port4 = getNextPort(port3 + 1);
+
+                from("jetty:http://localhost:"; + port1 + "/testRoute")
+                    .setBody().constant("local")
+                    .to("mock:endpoint");
+                
+                from("jetty:http://localhost:"; + port2 + "/testRoute")
+                    .setBody().constant("local-differentPort")
+                    .to("mock:endpoint");
+                
+                if (remoteInterfaceAddress != null) {
+                    from("jetty:http://"; + remoteInterfaceAddress + ":" + 
port3 + "/testRoute")
+                        .setBody().constant("remote")
+                        .to("mock:endpoint");
+                }
+                
+                from("jetty:http://0.0.0.0:"; + port4 + "/allInterfaces")
+                    .setBody().constant("allInterfaces")
+                    .to("mock:endpoint");
+                
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
new file mode 100644
index 0000000..7468083
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyCallHttpThenExceptionTest extends BaseJettyTest {
+
+    @Test
+    public void testJettyCallHttpThenException() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("World");
+        getMockEndpoint("mock:bar").expectedBodiesReceived("Bye World");
+
+        Exchange reply = 
template.request("http://localhost:{{port}}/myserver?throwExceptionOnFailure=false";,
 new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("World");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+
+        assertNotNull(reply);
+        
assertTrue(reply.getOut().getBody(String.class).startsWith("java.lang.IllegalArgumentException:
 I cannot do this"));
+        assertEquals(500, 
reply.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty://http://localhost:{{port}}/myserver";)
+                    .to("log:A")
+                    // remove http headers before and after invoking http 
service
+                    .removeHeaders("CamelHttp*")
+                    .to("http://localhost:{{port}}/other";)
+                    .removeHeaders("CamelHttp*")
+                    .to("mock:bar")
+                    // now just force an exception immediately
+                    .throwException(new IllegalArgumentException("I cannot do 
this"));
+
+                from("jetty://http://localhost:{{port}}/other";)
+                    .convertBodyTo(String.class)
+                    .to("log:C")
+                    .to("mock:foo")
+                    .transform().simple("Bye ${body}");
+            }
+        };
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
new file mode 100644
index 0000000..7e48c9f
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyCamelHttpUrlCBRTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class JettyCamelHttpUrlCBRTest extends BaseJettyTest {
+
+    @Test
+    public void testCamelHttpUrl() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:foo").expectedHeaderReceived("beer", "yes");
+        
getMockEndpoint("mock:foo").expectedHeaderReceived(Exchange.HTTP_METHOD, 
"POST");
+        getMockEndpoint("mock:foo").expectedHeaderReceived(Exchange.HTTP_URL, 
"http://localhost:"; + getPort() + "/foo");
+        getMockEndpoint("mock:foo").expectedHeaderReceived(Exchange.HTTP_URI, 
"/foo");
+        
getMockEndpoint("mock:foo").expectedHeaderReceived(Exchange.HTTP_QUERY, 
"beer=yes");
+        getMockEndpoint("mock:foo").expectedHeaderReceived(Exchange.HTTP_PATH, 
"");
+
+        String out = 
template.requestBody("http://localhost:{{port}}/foo?beer=yes";, "Hello World", 
String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://0.0.0.0:{{port}}/foo";)
+                        .filter().simple("${header.CamelHttpUrl} contains 
'foo'")
+                            .to("mock:foo")
+                        .end()
+                        .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
new file mode 100644
index 0000000..7814e02
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ *
+ */
+public class JettyComponentSpringConfiguredTest extends CamelSpringTestSupport 
{
+
+    @Override
+    protected boolean useJmx() {
+        return true;
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new 
ClassPathXmlApplicationContext("org/apache/camel/component/jetty/JettyComponentSpringConfiguredTest.xml");
+    }
+
+    @Test
+    @Ignore("run manual test")
+    public void testJetty2() throws Exception {
+        assertNotNull("Should have jetty2 component", 
context.hasComponent("jetty2"));
+
+        String reply = 
template.requestBody("jetty2:http://localhost:9090/myapp";, "Camel", 
String.class);
+        assertEquals("Hello Camel", reply);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
new file mode 100644
index 0000000..2a60a34
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+/**
+ * Unit test with a simple route test.
+ */
+public class JettyContentBasedRouteTest extends BaseJettyTest {
+
+    private String serverUri = "http://localhost:"; + getPort() + "/myservice";
+
+    @Test
+    public void testSendOne() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:one");
+
+        mock.expectedHeaderReceived("one", "true");
+
+        template.requestBody(serverUri + "?one=true", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testSendOther() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:other");
+
+        mock.expectedHeaderReceived("two", "true");
+
+        template.requestBody(serverUri + "?two=true", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // START SNIPPET: e1
+                from("jetty:" + serverUri)
+                    .choice()
+                    .when().simple("${header.one}").to("mock:one")
+                    .otherwise()
+                    .to("mock:other");
+                // END SNIPPET: e1
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
new file mode 100644
index 0000000..d2262a8
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.MessageHelper;
+import org.junit.Test;
+
+/**
+ * Unit test for content-type
+ */
+public class JettyContentTypeTest extends BaseJettyTest {
+
+    protected void sendMessageWithContentType(String charset, boolean 
usingGZip) {
+        Endpoint endpoint = 
context.getEndpoint("http://localhost:{{port}}/myapp/myservice";);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody("<order>123</order>");
+        exchange.getIn().setHeader("User", "Claus");
+        exchange.getIn().setHeader("SOAPAction", "test");
+        if (charset == null) {
+            exchange.getIn().setHeader("Content-Type", "text/xml");
+        } else {
+            exchange.getIn().setHeader("Content-Type", "text/xml; charset=" + 
charset);
+        }
+        if (usingGZip) {
+            exchange.getIn().setHeader(Exchange.CONTENT_ENCODING, "gzip");
+        }
+        template.send(endpoint, exchange);
+
+        String body = exchange.getOut().getBody(String.class);
+        assertEquals("<order>OK</order>", body);
+        assertEquals("Get a wrong content-type ", 
MessageHelper.getContentType(exchange.getOut()), "text/xml");
+    }
+
+    @Test
+    public void testSameContentType() throws Exception {
+        sendMessageWithContentType(null, false);
+        sendMessageWithContentType("UTF-8", false);
+    }
+    
+    @Test
+    public void testContentTypeWithGZipEncoding() throws Exception {
+        sendMessageWithContentType(null, true);
+        sendMessageWithContentType("UTF-8", true);
+    }
+
+    @Test
+    public void testMixedContentType() throws Exception {
+        Endpoint endpoint = 
context.getEndpoint("http://localhost:{{port}}/myapp/myservice";);
+        Exchange exchange = endpoint.createExchange();
+        exchange.getIn().setBody("<order>123</order>");
+        exchange.getIn().setHeader("Content-Type", "text/xml");
+        template.send(endpoint, exchange);
+
+        String body = exchange.getOut().getBody(String.class);
+        assertEquals("FAIL", body);
+        assertEquals("Get a wrong content-type ", 
MessageHelper.getContentType(exchange.getOut()), "text/plain");
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                
from("jetty:http://localhost:{{port}}/myapp/myservice";).process(new 
MyBookService());
+            }
+        };
+    }
+
+    public class MyBookService implements Processor {
+        public void process(Exchange exchange) throws Exception {
+            String user = exchange.getIn().getHeader("User", String.class);
+            String contentType = ExchangeHelper.getContentType(exchange);
+            String body = exchange.getIn().getBody(String.class);
+            String encoding = 
exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
+            if (encoding != null) {
+                exchange.getOut().setHeader(Exchange.CONTENT_ENCODING, 
encoding);
+            }
+            if ("Claus".equals(user) && contentType.startsWith("text/xml") && 
body.equals("<order>123</order>")) {
+                assertEquals("test", exchange.getIn().getHeader("SOAPAction", 
String.class));
+                if (contentType.endsWith("UTF-8")) {
+                    assertEquals("Get a wrong charset name.", 
exchange.getProperty(Exchange.CHARSET_NAME, String.class), "UTF-8");
+                }
+                exchange.getOut().setBody("<order>OK</order>");
+                exchange.getOut().setHeader("Content-Type", "text/xml");
+            } else {
+                exchange.getOut().setBody("FAIL");
+                exchange.getOut().setHeader(Exchange.CONTENT_TYPE, 
"text/plain");
+            }
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
new file mode 100644
index 0000000..135241f
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyContinuationDisabledTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyContinuationDisabledTest extends BaseJettyTest {
+
+    @Test
+    public void testJettyContinuationDisabled() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        String out = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // disable continuation
+                JettyHttpComponent jetty = context.getComponent("jetty", 
JettyHttpComponent.class);
+                jetty.setUseContinuation(false);
+
+                from("jetty:http://localhost:{{port}}/myservice";)
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws 
Exception {
+                            Thread.sleep(1000);
+                            exchange.getOut().setBody("Bye World");
+                        }
+                    })
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
new file mode 100644
index 0000000..d5b0adb
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Set;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class JettyEnableJmxTest extends BaseJettyTest {
+    
+    private String serverUri0;
+    private String serverUri1;
+    private String serverUri2;
+    private String serverUri3;
+    private MBeanServerConnection mbsc;
+
+    @Override
+    public void tearDown() throws Exception {
+        releaseMBeanServers();
+        mbsc = null;
+        super.tearDown();
+        disableJMX();
+    }
+
+    @Override
+    public void setUp() throws Exception {
+        enableJMX();
+        releaseMBeanServers();
+        super.setUp();
+        mbsc = getMBeanConnection();
+    }    
+    
+    @Test
+    public void testEnableJmxProperty() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        String expectedBody = "<html><body>foo</body></html>";
+        mock.expectedBodiesReceived(expectedBody, expectedBody, expectedBody, 
expectedBody);
+        mock.expectedHeaderReceived("x", "foo");
+
+        template.requestBody(serverUri0 + "&x=foo", null, Object.class);
+        template.requestBody(serverUri1 + "&x=foo", null, Object.class);
+        template.requestBody(serverUri2 + "&x=foo", null, Object.class);
+        template.requestBody(serverUri3 + "&x=foo", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+        
+        Set<ObjectName> s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 2 Jetty Server: " + s, 2, s.size());
+    }
+    
+    @Test
+    public void testShutdown() throws Exception {
+        Set<ObjectName> s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 2 Jetty Server: " + s, 2, s.size());
+        
+        context.stop();
+        
+        s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 0 Jetty Server: " + s, 0, s.size());
+    }
+    
+    @Test
+    public void testEndpointDisconnect() throws Exception {
+        Set<ObjectName> s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 2 Jetty Server: " + s, 2, s.size());
+        
+        context.stopRoute("route0");
+        
+        s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 1 Jetty Server: " + s, 1, s.size());
+        
+        context.stopRoute("route2");
+        context.stopRoute("route3");
+        
+        s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 1 Jetty Server: " + s, 1, s.size());
+        
+        context.stopRoute("route1");
+        
+        s = mbsc.queryNames(new 
ObjectName("org.eclipse.jetty.server:type=server,*"), null);
+        assertEquals("Could not find 0 Jetty Server: " + s, 0, s.size());
+    }
+
+    @Override
+    protected boolean useJmx() {
+        return true;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                serverUri0 = "http://localhost:"; + getNextPort() + 
"/myservice?enableJmx=true";
+                serverUri1 = "http://localhost:"; + getNextPort() + 
"/myservice?enableJmx=true";
+                serverUri2 = "http://localhost:"; + getNextPort() + 
"/myservice?enableJmx=false";
+                serverUri3 = "http://localhost:"; + getNextPort() + 
"/myservice?enableJmx=false";
+
+                from("jetty:" + serverUri0)
+                    .routeId("route0")
+                    
.setBody().simple("<html><body>${in.header.x}</body></html>")
+                    .to("mock:result");
+                
+                from("jetty:" + serverUri1)
+                    .routeId("route1")
+                    
.setBody().simple("<html><body>${in.header.x}</body></html>")
+                    .to("mock:result");
+                
+                from("jetty:" + serverUri2)
+                    .routeId("route2")
+                    
.setBody().simple("<html><body>${in.header.x}</body></html>")
+                    .to("mock:result");
+                
+                from("jetty:" + serverUri3)
+                    .routeId("route3")
+                    
.setBody().simple("<html><body>${in.header.x}</body></html>")
+                    .to("mock:result");
+            }
+        };
+    }
+    
+    protected void releaseMBeanServers() {
+        List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
+
+        for (MBeanServer server : servers) {
+            MBeanServerFactory.releaseMBeanServer(server);
+        }
+    }
+    
+    protected MBeanServerConnection getMBeanConnection() throws Exception {
+        if (mbsc == null) {
+            mbsc = ManagementFactory.getPlatformMBeanServer();
+        }
+        return mbsc;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
new file mode 100644
index 0000000..933d1c8
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointContinuationDisabledTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class JettyEndpointContinuationDisabledTest extends BaseJettyTest {
+
+    @Test
+    public void testJettyContinuationDisabled() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        String out = 
template.requestBody("http://localhost:{{port}}/myservice";, null, String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
from("jetty:http://localhost:{{port}}/myservice?useContinuation=false";)
+                    .process(new Processor() {
+                        public void process(Exchange exchange) throws 
Exception {
+                            Thread.sleep(1000);
+                            exchange.getOut().setBody("Bye World");
+                        }
+                    })
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
new file mode 100644
index 0000000..111d268
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyEndpointSetHttpTraceTest.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.TraceMethod;
+import org.junit.Test;
+
+public class JettyEndpointSetHttpTraceTest extends BaseJettyTest {
+
+    private int portTraceOn = getNextPort();
+    private int portTraceOff = getNextPort();
+
+    @Test
+    public void testTraceDisabled() throws Exception {        
+        HttpClient httpclient = new HttpClient();
+        TraceMethod trace = new TraceMethod("http://localhost:"; + portTraceOff 
+ "/myservice");
+        httpclient.executeMethod(trace);
+
+        // TRACE shouldn't be allowed by default
+        assertTrue(trace.getStatusCode() == 405);
+        trace.releaseConnection();
+    }
+    
+    @Test
+    public void testTraceEnabled() throws Exception {        
+        HttpClient httpclient = new HttpClient();
+        TraceMethod trace = new TraceMethod("http://localhost:"; + portTraceOn 
+ "/myservice");
+        httpclient.executeMethod(trace);
+
+        // TRACE is now allowed
+        assertTrue(trace.getStatusCode() == 200);
+        trace.releaseConnection();
+    }
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://localhost:"; + portTraceOff + 
"/myservice").to("log:foo");
+                from("jetty:http://localhost:"; + portTraceOn + 
"/myservice?traceEnabled=true").to("log:bar");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
new file mode 100644
index 0000000..12282de
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Component;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.junit.Test;
+
+/**
+ * Based on end user on forum how to get the 404 error code in his enrich 
aggregator
+ *
+ * @version 
+ */
+public class JettyHandle404Test extends BaseJettyTest {
+
+    public String getProducerUrl() {
+        return "http://localhost:{{port}}/myserver?user=Camel";;
+    }
+
+    @Test
+    public void testSimulate404() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Page not found");
+        mock.expectedHeaderReceived(Exchange.HTTP_RESPONSE_CODE, 404);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+    
+    @Test
+    public void testCustomerErrorHandler() throws Exception {
+        String response = 
template.requestBody("http://localhost:{{port}}/myserver1?throwExceptionOnFailure=false";,
 null, String.class);
+        // look for the error message which is sent by MyErrorHandler
+        assertTrue("Get a wrong error message", 
response.indexOf("MyErrorHandler") > 0);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // setup the jetty component with the customx error handler
+                JettyHttpComponent jettyComponent = 
(JettyHttpComponent)context.getComponent("jetty");
+                jettyComponent.setErrorHandler(new MyErrorHandler());
+                
+                // disable error handling
+                errorHandler(noErrorHandler());
+
+                from("direct:start").enrich("direct:tohttp", new 
AggregationStrategy() {
+                    public Exchange aggregate(Exchange original, Exchange 
resource) {
+                        // get the response code
+                        Integer code = 
resource.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
+                        assertEquals(404, code.intValue());
+                        return resource;
+                    }
+                }).to("mock:result");
+
+                // use this sub route as indirection to handle the 
HttpOperationFailedException
+                // and set the data back as data on the exchange to not cause 
the exception to be thrown
+                from("direct:tohttp")
+                        .doTry()
+                            .to(getProducerUrl())
+                        .doCatch(HttpOperationFailedException.class)
+                            .process(new Processor() {
+                                public void process(Exchange exchange) {
+                                    // copy the caused exception values to the 
exchange as we want the response in the regular exchange
+                                    // instead as an exception that will get 
thrown and thus the route breaks
+                                    HttpOperationFailedException cause = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
HttpOperationFailedException.class);
+                                    
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, cause.getStatusCode());
+                                    
exchange.getOut().setBody(cause.getResponseBody());
+                                }
+                            })
+                        .end();
+
+
+                // this is our jetty server where we simulate the 404
+                from("jetty://http://localhost:{{port}}/myserver";)
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws 
Exception {
+                                exchange.getOut().setBody("Page not found");
+                                
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 404);
+                            }
+                        });
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
new file mode 100644
index 0000000..54e6989
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.IOException;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.junit.Test;
+
+/**
+ * Unit test for jetty http binding ref option.
+ */
+public class JettyHttpBindingRefTest extends BaseJettyTest {
+
+    @Test
+    public void testDefaultJettyHttpBinding() throws Exception {
+        Object out = 
template.requestBody("jetty:http://localhost:{{port}}/myapp/myservice?jettyHttpBindingRef=default";,
 "Hello World");
+        assertEquals("Bye World", 
context.getTypeConverter().convertTo(String.class, out));
+
+        try {
+            
template.requestBody("jetty:http://localhost:{{port}}/myapp/myotherservice";, 
"Hello World");
+            fail();
+        } catch (CamelExecutionException e) {
+            assertNotNull(e.getCause());
+            assertTrue(e.getCause() instanceof HttpOperationFailedException);
+
+            assertFalse("Not exactly the message the server 
returned.".equals(((HttpOperationFailedException) 
e.getCause()).getResponseBody()));
+        }
+    }
+
+    @Test
+    public void testCustomJettyHttpBinding() throws Exception {
+        
+        Object out = 
template.requestBody("jetty:http://localhost:{{port}}/myapp/myotherservice?jettyHttpBindingRef=myownbinder";,
 "Hello World");
+        assertEquals("Not exactly the message the server returned.", 
context.getTypeConverter().convertTo(String.class, out));
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("default", new DefaultJettyHttpBinding());
+        jndi.bind("myownbinder", new MyJettyHttpBinding());
+        return jndi;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                errorHandler(noErrorHandler());
+
+                
from("jetty:http://localhost:{{port}}/myapp/myservice";).transform().constant("Bye
 World");
+
+                
from("jetty:http://localhost:{{port}}/myapp/myotherservice";).process(new 
Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        throw new IllegalStateException("Not implemented");
+                    }
+                });
+            }
+        };
+    }
+
+    // START SNIPPET: e1
+    public class MyJettyHttpBinding extends DefaultJettyHttpBinding {
+        @Override
+        protected void populateResponse(Exchange exchange, 
JettyContentExchange httpExchange, Message in,
+                                        HeaderFilterStrategy strategy, int 
responseCode) throws IOException {
+
+            Message answer = exchange.getOut();
+
+            answer.setHeaders(in.getHeaders());
+            answer.setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
+            answer.setBody("Not exactly the message the server returned.");
+        }
+    }
+    // END SNIPPET: e1
+
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
new file mode 100644
index 0000000..a09afc4
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class JettyHttpBridgeEncodedPathTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Test
+    public void testJettyHttpClient() throws Exception {
+        String response = template.requestBody("http://localhost:"; + port2 + 
"/jettyTestRouteA?param1=%2B447777111222", null, String.class);
+        assertEquals("Get a wrong response", "param1=+447777111222", response);
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+
+                port1 = getPort();
+                port2 = getNextPort();
+
+                errorHandler(noErrorHandler());
+
+                Processor serviceProc = new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        // %2B becomes decoded to a space
+                        Object s = exchange.getIn().getHeader("param1");
+                        // can be either + or %2B
+                        assertTrue(s.equals(" 447777111222") || 
s.equals("+447777111222") || s.equals("%2B447777111222"));
+
+                        // send back the query
+                        
exchange.getOut().setBody(exchange.getIn().getHeader(Exchange.HTTP_QUERY));
+                    }
+                };
+                from("jetty://http://localhost:"; + port2 + 
"/jettyTestRouteA?matchOnUriPrefix=true")
+                        .log("Using JettyTestRouteA route: 
CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
+                        .to("jetty://http://localhost:"; + port1 + 
"/jettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
+
+                from("jetty://http://localhost:"; + port1 + 
"/jettyTestRouteB?matchOnUriPrefix=true")
+                        .log("Using JettyTestRouteB route: 
CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
+                        .process(serviceProc);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
new file mode 100644
index 0000000..387cdeb
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.HttpProducer;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.Test;
+
+/**
+ * Unit test for http client options.
+ */
+public class JettyHttpClientOptionsTest extends BaseJettyTest {
+
+    @Test
+    public void testCustomHttpBinding() throws Exception {
+        // assert jetty was configured with our timeout
+        HttpEndpoint jettyEndpoint = 
context.getEndpoint("http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=5555";,
 HttpEndpoint.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));
+    }
+    
+    @Test
+    public void testProxySettingOfJettyHttpClient() throws Exception {
+        // setup the Proxy setting through the URI
+        HttpEndpoint jettyEndpoint = 
context.getEndpoint("jetty://http://localhost:{{port}}/proxy/setting?proxyHost=192.168.0.1&proxyPort=9090";,
 HttpEndpoint.class);
+        assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
+        JettyHttpProducer producer = 
(JettyHttpProducer)jettyEndpoint.createProducer();
+        assertProxyAddress(producer.getClient(), "192.168.0.1", 9090);
+
+        // setup the context properties
+        context.getProperties().put("http.proxyHost", "192.168.0.2");
+        context.getProperties().put("http.proxyPort", "8080");
+        jettyEndpoint = 
context.getEndpoint("jetty://http://localhost:{{port}}/proxy2/setting";, 
HttpEndpoint.class);
+        producer = (JettyHttpProducer)jettyEndpoint.createProducer();
+        assertProxyAddress(producer.getClient(), "192.168.0.2", 8080);
+        context.getProperties().clear();
+
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
from("jetty:http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=5555";).transform().constant("Bye
 World");
+            }
+        };
+    }
+    
+    private void assertProxyAddress(HttpClient client, String expectedHost, 
int expectedPort) {
+        CamelHttpClient camelHttpClient = (CamelHttpClient)client;
+        assertEquals("Got the wrong http proxy host parameter", expectedHost, 
camelHttpClient.getProxyHost());
+        assertEquals("Got the wrong http proxy port paramerter", expectedPort, 
camelHttpClient.getProxyPort());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..eae83bf
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JettyHttpComponentConfigurationAndDocumentationTest extends 
CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        JettyHttpComponent comp = context.getComponent("jetty", 
JettyHttpComponent.class);
+        EndpointConfiguration conf = 
comp.createConfiguration("jetty://http://localhost:8080/myapp?";
+                + "httpClientMinThreads=4&httpClientMaxThreads=8");
+
+        assertEquals("4", conf.getParameter("httpClientMinThreads"));
+        assertEquals("8", conf.getParameter("httpClientMaxThreads"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+        assertTrue(json.contains("\"httpClientMaxThreads\": { \"type\": 
\"integer\""));
+        assertTrue(json.contains("\"sessionSupport\": { \"type\": \"boolean\", 
\"javaType\": \"boolean\" },"));
+    }
+
+    @Test
+    @Ignore // TODO Need to investigate why this fails while html is present
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("jetty");
+        assertNotNull("Should have found some auto-generated HTML", html);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
new file mode 100644
index 0000000..1edc74b
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.nio.charset.Charset;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class JettyHttpContentTypeTest extends BaseJettyTest {
+
+    private static final String CHARSET = "ISO-8859-1";
+
+    @Test
+    public void testContentType() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE,
+                                                             "text/plain; 
charset=\"" + CHARSET + "\"");
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING,
 CHARSET);
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL,
+                                                             "http://0.0.0.0:"; 
+ getPort() + "/foo");
+        
getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, 
CHARSET);
+
+        byte[] data = "Hello World".getBytes(Charset.forName(CHARSET));
+        String out = 
template.requestBodyAndHeader("jetty:http://0.0.0.0:{{port}}/foo";, data,
+                "content-type", "text/plain; charset=\"" + CHARSET + "\"", 
String.class);
+        assertEquals("Bye World", out);
+
+        Exchange exchange = 
getMockEndpoint("mock:input").getExchanges().get(0);
+        Message in = exchange.getIn();
+        System.out.println(in.getHeaders());
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testContentTypeWithAction() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE,
+                                                             
"text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"";);
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING,
 CHARSET);
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, 
"http://0.0.0.0:"; + getPort() + "/foo");
+        
getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, 
CHARSET);
+
+        byte[] data = "Hello World".getBytes(Charset.forName(CHARSET));
+        String out = 
template.requestBodyAndHeader("jetty:http://0.0.0.0:{{port}}/foo";, data,
+                "content-type", "text/plain;charset=\"" + CHARSET + 
"\";action=\"http://somewhere.com/foo\"";, String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("jetty:http://0.0.0.0:{{port}}/foo";)
+                        .to("mock:input")
+                        .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a59becd7/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
new file mode 100644
index 0000000..373681c
--- /dev/null
+++ 
b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * Unit test to verify that the Jetty HTTP connector is correctly disconnected 
on shutdown
+ */
+public class JettyHttpEndpointDisconnectTest extends BaseJettyTest {
+
+    private String serverUri = "http://localhost:"; + getPort() + "/myservice";
+
+    @Test
+    public void testContextShutdownRemovesHttpConnector() throws Exception {
+        context.stop();
+        assertEquals("Connector should have been removed", 0, 
JettyHttpComponent.CONNECTORS.size());
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("jetty:" + serverUri).to("mock:result");
+            }
+        };
+    }
+}

Reply via email to