You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/09/05 15:13:23 UTC

[5/9] CAMEL-7782 Added camel-netty4-http component

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java
new file mode 100644
index 0000000..b1d4dbc
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestBeanTest.java
@@ -0,0 +1,54 @@
+/**
+ * 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.netty4.http;
+
+import java.nio.charset.Charset;
+
+import io.netty.handler.codec.http.FullHttpRequest;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpAccessHttpRequestBeanTest extends BaseNettyTest {
+
+    @Test
+    public void testAccessHttpRequest() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("World");
+
+        String out = template.requestBody("netty4-http:http://localhost:{{port}}/foo", "World", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://0.0.0.0:{{port}}/foo")
+                    .to("mock:input")
+                    .transform().method(NettyHttpAccessHttpRequestBeanTest.class, "myTransformer");
+            }
+        };
+    }
+
+    public static String myTransformer(FullHttpRequest request) {
+        String in = request.content().toString(Charset.forName("UTF-8"));
+        return "Bye " + in;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.java
new file mode 100644
index 0000000..aa3ce53
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpAccessHttpRequestTest.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.netty4.http;
+
+import io.netty.handler.codec.http.HttpRequest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+import org.junit.Test;
+
+public class NettyHttpAccessHttpRequestTest extends BaseNettyTest {
+
+    @Test
+    public void testAccessHttpRequest() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+
+        String out = template.requestBody("netty4-http:http://localhost:{{port}}/foo", "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("netty4-http:http://0.0.0.0:{{port}}/foo")
+                    .to("mock:input")
+                    .process(new Processor() {
+                        @Override
+                        public void process(Exchange exchange) throws Exception {
+                            // we can get the original http request
+                            HttpRequest request = exchange.getIn(NettyHttpMessage.class).getHttpRequest();
+                            assertNotNull(request);
+                        }
+                    })
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthConstraintMapperTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthConstraintMapperTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthConstraintMapperTest.java
new file mode 100644
index 0000000..b2dc7f7
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthConstraintMapperTest.java
@@ -0,0 +1,96 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("TODO fix it")
+public class NettyHttpBasicAuthConstraintMapperTest extends BaseNettyTest {
+
+    @Override
+    public void setUp() throws Exception {
+        System.setProperty("java.security.auth.login.config", "src/test/resources/myjaas.config");
+        super.setUp();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        System.clearProperty("java.security.auth.login.config");
+        super.tearDown();
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+
+        NettyHttpSecurityConfiguration security = new NettyHttpSecurityConfiguration();
+        security.setRealm("karaf");
+        SecurityAuthenticator auth = new JAASSecurityAuthenticator();
+        auth.setName("karaf");
+        security.setSecurityAuthenticator(auth);
+
+        SecurityConstraintMapping matcher = new SecurityConstraintMapping();
+        matcher.addInclusion("/*");
+        matcher.addExclusion("/public/*");
+        security.setSecurityConstraint(matcher);
+
+        jndi.bind("mySecurityConfig", security);
+
+        return jndi;
+    }
+
+    @Test
+    public void testBasicAuth() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello Public", "Hello World");
+
+        // we dont need auth for the public page
+        String out = template.requestBody("netty4-http:http://localhost:{{port}}/foo/public/hello.txt", "Hello Public", String.class);
+        assertEquals("Bye World", out);
+
+        try {
+            template.requestBody("netty4-http:http://localhost:{{port}}/foo", "Hello World", String.class);
+            fail("Should send back 401");
+        } catch (CamelExecutionException e) {
+            NettyHttpOperationFailedException cause = assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause());
+            assertEquals(401, cause.getStatusCode());
+        }
+
+        // username:password is scott:secret
+        String auth = "Basic c2NvdHQ6c2VjcmV0";
+        out = template.requestBodyAndHeader("netty4-http:http://localhost:{{port}}/foo", "Hello World", "Authorization", auth, String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://0.0.0.0:{{port}}/foo?matchOnUriPrefix=true&securityConfiguration=#mySecurityConfig")
+                    .to("mock:input")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthCustomSecurityAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthCustomSecurityAuthenticatorTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthCustomSecurityAuthenticatorTest.java
new file mode 100644
index 0000000..7954212
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthCustomSecurityAuthenticatorTest.java
@@ -0,0 +1,105 @@
+/**
+ * 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.netty4.http;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("TODO fix it")
+public class NettyHttpBasicAuthCustomSecurityAuthenticatorTest extends BaseNettyTest {
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myAuthenticator", new MyAuthenticator());
+        return jndi;
+    }
+
+    @Test
+    public void testBasicAuth() throws Exception {
+        try {
+            template.requestBody("netty4-http:http://localhost:{{port}}/foo", "Hello World", String.class);
+            fail("Should send back 401");
+        } catch (CamelExecutionException e) {
+            NettyHttpOperationFailedException cause = assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause());
+            assertEquals(401, cause.getStatusCode());
+        }
+
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+
+        // username:password is scott:secret
+        String auth = "Basic c2NvdHQ6c2VjcmV0";
+        String out = template.requestBodyAndHeader("netty4-http:http://localhost:{{port}}/foo", "Hello World", "Authorization", auth, String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://0.0.0.0:{{port}}/foo?securityConfiguration.realm=foo&securityConfiguration.securityAuthenticator=#myAuthenticator")
+                    .to("mock:input")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+    private final class MyAuthenticator implements SecurityAuthenticator {
+
+        public void setName(String name) {
+            // noop
+        }
+
+        public String getName() {
+            return null;
+        }
+
+        @Override
+        public void setRoleClassNames(String names) {
+            // noop
+        }
+
+        @Override
+        public Subject login(HttpPrincipal principal) throws LoginException {
+            if (!principal.getPassword().equalsIgnoreCase("secret")) {
+                throw new LoginException("Login denied");
+            }
+            // login success so return a subject
+            return new Subject();
+        }
+
+        @Override
+        public void logout(Subject subject) throws LoginException {
+            // noop
+        }
+
+        @Override
+        public String getUserRoles(Subject subject) {
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthTest.java
new file mode 100644
index 0000000..ecaefff
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBasicAuthTest.java
@@ -0,0 +1,104 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+
+public class NettyHttpBasicAuthTest extends BaseNettyTest {
+
+    @Override
+    public void setUp() throws Exception {
+        System.setProperty("java.security.auth.login.config", "src/test/resources/myjaas.config");
+        super.setUp();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        System.clearProperty("java.security.auth.login.config");
+        super.tearDown();
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+
+        NettyHttpSecurityConfiguration security = new NettyHttpSecurityConfiguration();
+        security.setRealm("karaf");
+        SecurityAuthenticator auth = new JAASSecurityAuthenticator();
+        auth.setName("karaf");
+        security.setSecurityAuthenticator(auth);
+
+        jndi.bind("mySecurityConfig", security);
+
+        return jndi;
+    }
+
+    @Test
+    public void testBasicAuthFailed() throws Exception {
+        try {
+            template.requestBody("netty4-http:http://localhost:{{port}}/foo", "Hello World", String.class);
+            fail("Should send back 401");
+        } catch (CamelExecutionException e) {
+            NettyHttpOperationFailedException cause = assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause());
+            assertEquals(401, cause.getStatusCode());
+        }
+        
+    }
+   
+    @Test
+    public void testBasicAuthSuccessed() throws Exception {
+
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:input").expectedHeaderReceived(NettyHttpConstants.HTTP_AUTHENTICATION, "Basic");
+
+        // username:password is scott:secret
+        String auth = "Basic c2NvdHQ6c2VjcmV0";
+        String out = template.requestBodyAndHeader("netty4-http:http://localhost:{{port}}/foo", "Hello World", "Authorization", auth, String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testInvalidCredentials() throws Exception {
+        // username:password is scott:typo
+        try {
+            // password is invalid so we should get a 401
+            String auth = "Basic c2NvdHQ6dHlwbw==";
+            template.requestBodyAndHeader("netty4-http:http://localhost:{{port}}/foo", "Hello World", "Authorization", auth, String.class);
+        } catch (CamelExecutionException e) {
+            NettyHttpOperationFailedException cause = assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause());
+            assertEquals(401, cause.getStatusCode());
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://0.0.0.0:{{port}}/foo?securityConfiguration=#mySecurityConfig")
+                    .to("mock:input")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
new file mode 100644
index 0000000..3f96d39
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBindingPreservePostFormUrlEncodedBodyTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpMethods;
+import org.junit.Test;
+
+public class NettyHttpBindingPreservePostFormUrlEncodedBodyTest extends BaseNettyTest {
+
+    @Test
+    public void testSendToNetty() throws Exception {
+        Exchange exchange = template.request("netty4-http:http://localhost:{{port}}/myapp/myservice?query1=a&query2=b", new Processor() {
+
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("b1=x&b2=y");
+                exchange.getIn().setHeader("content-type", "application/x-www-form-urlencoded");
+                exchange.getIn().setHeader(Exchange.HTTP_METHOD, HttpMethods.POST);
+            }
+
+        });
+        // convert the response to a String
+        String body = exchange.getOut().getBody(String.class);
+        assertEquals("Request message is OK", body);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("netty4-http:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String body = exchange.getIn().getBody(String.class);
+
+                        // for unit testing make sure we got right message
+                        assertEquals("The body message is wrong", "b1=x&b2=y", body);
+                        assertEquals("Get a wrong query parameter from the message header", "a", exchange.getIn().getHeader("query1"));
+                        assertEquals("Get a wrong query parameter from the message header", "b", exchange.getIn().getHeader("query2"));
+                        assertEquals("Get a wrong form parameter from the message header", "x", exchange.getIn().getHeader("b1"));
+                        assertEquals("Get a wrong form parameter from the message header", "y", exchange.getIn().getHeader("b2"));
+
+                        // send a response
+                        exchange.getOut().getHeaders().clear();
+                        exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "text/plain");
+                        exchange.getOut().setBody("Request message is OK");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeEncodedPathTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeEncodedPathTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeEncodedPathTest.java
new file mode 100644
index 0000000..59c82f6
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeEncodedPathTest.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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpBridgeEncodedPathTest extends BaseNettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Test
+    public void testHttpClient() throws Exception {
+        String response = template.requestBody("http://localhost:" + port2 + "/nettyTestRouteA?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("netty4-http://http://localhost:" + port2 + "/nettyTestRouteA?matchOnUriPrefix=true")
+                        .log("Using NettyTestRouteA route: CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
+                        .to("netty4-http://http://localhost:" + port1 + "/nettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
+
+                from("netty4-http://http://localhost:" + port1 + "/nettyTestRouteB?matchOnUriPrefix=true")
+                        .log("Using NettyTestRouteB route: CamelHttpPath=[${header.CamelHttpPath}], CamelHttpUri=[${header.CamelHttpUri}]")
+                        .process(serviceProc);
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeRouteUsingHttpClientTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeRouteUsingHttpClientTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeRouteUsingHttpClientTest.java
new file mode 100644
index 0000000..ea598cd
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpBridgeRouteUsingHttpClientTest.java
@@ -0,0 +1,92 @@
+/**
+ * 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.netty4.http;
+
+import java.io.ByteArrayInputStream;
+
+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.junit.Test;
+
+public class NettyHttpBridgeRouteUsingHttpClientTest extends BaseNettyTest {
+
+    private int port1;
+    private int port2;
+
+    @Test
+    public void testBridge() throws Exception {
+        String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/test/hello",
+                new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
+        assertEquals("Get a wrong response", "/", response);
+
+        response = template.requestBody("http://localhost:" + port1 + "/hello/world", "hello", String.class);
+        assertEquals("Get a wrong response", "/hello/world", response);
+
+        try {
+            template.requestBody("http://localhost:" + port2 + "/hello/world", "hello", String.class);
+            fail("Expect exception here!");
+        } catch (Exception ex) {
+            assertTrue("We should get a RuntimeCamelException", ex instanceof RuntimeCamelException);
+        }
+    }
+    
+    @Test
+    public void testSendFormRequestMessage() throws Exception {
+        String out = template.requestBodyAndHeader("http://localhost:" + port2 + "/form", "username=abc&pass=password", Exchange.CONTENT_TYPE, "application/x-www-form-urlencoded", String.class);
+        assertEquals("Get a wrong response message", "username=abc&pass=password", out);
+    }
+
+    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 {
+                        // get the request URL and copy it to the request body
+                        String uri = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
+                        exchange.getOut().setBody(uri);
+                    }
+                };
+                from("netty4-http:http://localhost:" + port2 + "/test/hello")
+                        .to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
+
+                from("netty4-http:http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
+                
+                // check the from request
+                from("netty4-http:http://localhost:" + port2 + "/form?bridgeEndpoint=true")
+                    .process(new Processor() {
+                        @Override
+                        public void process(Exchange exchange) throws Exception {
+                            // just take out the message body and send it back
+                            Message in = exchange.getIn();
+                            String request = in.getBody(String.class);
+                            exchange.getOut().setBody(request);
+                        }
+                        
+                    });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCharacterEncodingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCharacterEncodingTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCharacterEncodingTest.java
new file mode 100644
index 0000000..6776b42
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCharacterEncodingTest.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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpCharacterEncodingTest extends BaseNettyTest {
+
+    @Test
+    public void testSendToNetty() throws Exception {
+        Exchange exchange = template.request("netty4-http:http://localhost:{{port}}/myapp/myservice", new Processor() {
+
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Hello World Thai Elephant \u0E08");
+                exchange.getIn().setHeader("Content-Type", "text/html; charset=utf-8");
+            }
+
+        });
+        // convert the response to a String
+        String body = exchange.getOut().getBody(String.class);
+        assertEquals("Response message is Thai Elephant \u0E08", body);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("netty4-http:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
+            }
+        };
+    }
+
+    public class MyBookService implements Processor {
+        public void process(Exchange exchange) throws Exception {
+            // just get the body as a string
+            String body = exchange.getIn().getBody(String.class);
+
+            // for unit testing make sure we got right message
+            assertEquals("Hello World Thai Elephant \u0E08", body);
+
+            // send a html response
+            exchange.getOut().setHeader("Content-Type", "text/html; charset=utf-8");
+            exchange.getOut().setBody("Response message is Thai Elephant \u0E08");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientChunkedTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientChunkedTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientChunkedTest.java
new file mode 100644
index 0000000..984b047
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientChunkedTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpClientChunkedTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpSimple() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+
+        String out = template.requestBody("netty4-http:http://localhost:{{port}}/foo", "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("netty4-http:http://0.0.0.0:{{port}}/foo")
+                    .to("mock:input")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientExpectContinueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientExpectContinueTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientExpectContinueTest.java
new file mode 100644
index 0000000..365d76a
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpClientExpectContinueTest.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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("TODO Fix it, need to send the response back")
+public class NettyHttpClientExpectContinueTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpExpect100Continue() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("request body");
+
+        String body = "request body";
+        DefaultExchange exchange = new DefaultExchange(context);
+
+        exchange.getIn().setHeader("Expect", "100-continue");
+        exchange.getIn().setBody(body);
+
+        Exchange result = template.send("netty4-http:http://localhost:{{port}}/foo", exchange);
+        
+        assertFalse(result.isFailed());
+        assertEquals("Bye World", result.getIn().getBody(String.class));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://0.0.0.0:{{port}}/foo")
+                    .to("mock:input")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpComponentConfigurationAndDocumentationTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..db5186f
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.netty4.http;
+
+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.Test;
+
+public class NettyHttpComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        NettyHttpComponent comp = context.getComponent("netty4-http", NettyHttpComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("netty4-http:tcp://localhost:5150?sync=true"
+                + "&httpMethodRestrict=POST&traceEnabled=true");
+
+        assertEquals("true", conf.getParameter("traceEnabled"));
+        assertEquals("POST", conf.getParameter("httpMethodRestrict"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"httpMethodRestrict\": { \"type\": \"string\" }"));
+        assertTrue(json.contains("\"traceEnabled\": { \"type\": \"boolean\" }"));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("netty4-http");
+        assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpContentTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpContentTypeTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpContentTypeTest.java
new file mode 100644
index 0000000..6a9fbcb
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpContentTypeTest.java
@@ -0,0 +1,87 @@
+/**
+ * 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.netty4.http;
+
+import java.nio.charset.Charset;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpContentTypeTest extends BaseNettyTest {
+
+    @Test
+    public void testContentType() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "text/plain; charset=\"iso-8859-1\"");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, "iso-8859-1");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://0.0.0.0:" + getPort() + "/foo");
+        getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, "iso-8859-1");
+
+        byte[] data = "Hello World".getBytes(Charset.forName("iso-8859-1"));
+        String out = template.requestBodyAndHeader("netty4-http:http://0.0.0.0:{{port}}/foo", data,
+                "content-type", "text/plain; charset=\"iso-8859-1\"", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testContentTypeWithAction() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "text/plain;charset=\"iso-8859-1\";action=\"http://somewhere.com/foo\"");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, "iso-8859-1");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://0.0.0.0:" + getPort() + "/foo");
+        getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, "iso-8859-1");
+
+        byte[] data = "Hello World".getBytes(Charset.forName("iso-8859-1"));
+        String out = template.requestBodyAndHeader("netty4-http:http://0.0.0.0:{{port}}/foo", data,
+                "content-type", "text/plain;charset=\"iso-8859-1\";action=\"http://somewhere.com/foo\"", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testContentTypeWithActionAndPlus() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/soap+xml;charset=\"utf-8\";action=\"http://somewhere.com/foo\"");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, "utf-8");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://0.0.0.0:" + getPort() + "/foo");
+        getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, "utf-8");
+
+        byte[] data = "Hello World".getBytes(Charset.forName("utf-8"));
+        String out = template.requestBodyAndHeader("netty4-http:http://0.0.0.0:{{port}}/foo", data,
+                "content-type", "application/soap+xml;charset=\"utf-8\";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("netty4-http:http://0.0.0.0:{{port}}/foo")
+                    .to("mock:input")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpConvertPayloadToInputStreamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpConvertPayloadToInputStreamTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpConvertPayloadToInputStreamTest.java
new file mode 100644
index 0000000..3f5c030
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpConvertPayloadToInputStreamTest.java
@@ -0,0 +1,62 @@
+/**
+ * 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.netty4.http;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class NettyHttpConvertPayloadToInputStreamTest extends BaseNettyTest {
+
+    protected String expectedBody = "<hello>world!</hello>";
+
+    @Test
+    public void testConvertPayloadToInputStream() throws Exception {
+        MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
+        mockEndpoint.expectedMessageCount(1);
+
+        template.requestBodyAndHeader("netty4-http:http://localhost:{{port}}/test", expectedBody, "Content-Type", "application/xml");
+
+        mockEndpoint.assertIsSatisfied();
+        List<Exchange> list = mockEndpoint.getReceivedExchanges();
+        Exchange exchange = list.get(0);
+        assertNotNull("exchange", exchange);
+
+        Message in = exchange.getIn();
+        assertNotNull("in", in);
+
+        Object actual = in.getBody();
+        InputStream value = assertIsInstanceOf(InputStream.class, actual);
+        assertNotNull("InputStream", value);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("netty4-http:http://localhost:{{port}}/test").
+                        convertBodyTo(InputStream.class).
+                        to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriCustomHeaderFilterStrategyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriCustomHeaderFilterStrategyTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriCustomHeaderFilterStrategyTest.java
new file mode 100644
index 0000000..9d78016
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriCustomHeaderFilterStrategyTest.java
@@ -0,0 +1,70 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+
+public class NettyHttpEndpointUriCustomHeaderFilterStrategyTest extends BaseNettyTest {
+
+    @Test
+    public void testEndpointUriWithCustomHeaderStrategy() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:outbound");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("Date", "31-03-2014");
+
+        Exchange out = template.request("direct:request", null);
+
+        assertMockEndpointsSatisfied();
+
+        String date = out.getOut().getHeader("sub-date", String.class);
+        assertNull(date);
+    }
+
+    @Override protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("customHeaderFilterStrategy", new CustomHeaderFilterStrategy());
+        return registry;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:request")
+                    .setHeader("Date", constant("31-03-2014"))
+                    .to("netty4-http:http://localhost:{{port}}/myapp/mytest?headerFilterStrategy=#customHeaderFilterStrategy");
+
+                from("netty4-http:http://localhost:{{port}}/myapp/mytest")
+                    .to("mock:outbound")
+                    .setHeader("sub-date", constant("31-05-2014"));
+            }
+        };
+    }
+
+    private class CustomHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
+        public CustomHeaderFilterStrategy() {
+            // allow all outbound headers to pass through but only filter out below inbound header 
+            getInFilter().add("sub-date");
+        }   
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueTest.java
new file mode 100644
index 0000000..fa6220f
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpEndpointUriEncodingIssueTest extends BaseNettyTest {
+
+    @Test
+    public void testEndpointUriEncodingIssue() throws Exception {
+        String uri = "netty4-http:http://localhost:{{port}}/myapp/mytest?columns=totalsens,upsens&username=apiuser";
+        String out = template.requestBody(uri, null, String.class);
+
+        assertEquals("We got totalsens,upsens columns", out);
+    }
+
+    @Test
+    public void testEndpointUriWithDanishCharEncodingIssue() throws Exception {
+        String uri = "netty4-http:http://localhost:{{port}}/myapp/mytest?columns=claus,s\u00F8ren&username=apiuser";
+        String out = template.requestBody(uri, null, String.class);
+
+        assertEquals("We got claus,s\u00F8ren columns", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://localhost:{{port}}/myapp/mytest?urlDecodeHeaders=true").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String columns = exchange.getIn().getHeader("columns", String.class);
+                        exchange.getOut().setBody("We got " + columns + " columns");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueUrlDecodeDisabledTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueUrlDecodeDisabledTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueUrlDecodeDisabledTest.java
new file mode 100644
index 0000000..7e98851
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpEndpointUriEncodingIssueUrlDecodeDisabledTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpEndpointUriEncodingIssueUrlDecodeDisabledTest extends BaseNettyTest {
+
+    @Test
+    public void testEndpointUriWithDanishCharEncodingIssue() throws Exception {
+        String uri = "netty4-http:http://localhost:{{port}}/myapp/mytest?columns=claus,s\u00F8ren&username=apiuser";
+        String out = template.requestBody(uri, null, String.class);
+
+        assertEquals("We got claus%2Cs%C3%B8ren columns", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://localhost:{{port}}/myapp/mytest?urlDecodeHeaders=false").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String columns = exchange.getIn().getHeader("columns", String.class);
+                        exchange.getOut().setBody("We got " + columns + " columns");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpFilterCamelHeadersTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpFilterCamelHeadersTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpFilterCamelHeadersTest.java
new file mode 100644
index 0000000..c032a65
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpFilterCamelHeadersTest.java
@@ -0,0 +1,76 @@
+/**
+ * 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.netty4.http;
+
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+
+public class NettyHttpFilterCamelHeadersTest extends BaseNettyTest {
+
+    @Test
+    public void testFilterCamelHeaders() throws Exception {
+        Exchange out = template.request("netty4-http:http://localhost:{{port}}/test/filter", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Claus");
+                exchange.getIn().setHeader("bar", 123);
+            }
+        });
+
+        assertNotNull(out);
+        assertEquals("Hi Claus", out.getOut().getBody(String.class));
+
+        // there should be no internal Camel headers
+        // except for the response code and response text
+        Map<String, Object> headers = out.getOut().getHeaders();
+        for (String key : headers.keySet()) {
+            if (!key.equalsIgnoreCase(Exchange.HTTP_RESPONSE_CODE) && !key.equalsIgnoreCase(NettyHttpConstants.HTTP_RESPONSE_TEXT)) {
+                assertTrue("Should not contain any Camel internal headers", !key.toLowerCase().startsWith("camel"));
+            }
+        }
+        assertEquals(200, headers.get(Exchange.HTTP_RESPONSE_CODE));
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("foo", new MyFooBean());
+        return jndi;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty4-http:http://localhost:{{port}}/test/filter").beanRef("foo");
+            }
+        };
+    }
+
+    public static class MyFooBean {
+
+        public String hello(String name) {
+            return "Hi " + name;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithInvalidMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithInvalidMessageTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithInvalidMessageTest.java
new file mode 100644
index 0000000..3fdc57d
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithInvalidMessageTest.java
@@ -0,0 +1,106 @@
+/**
+ * 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.netty4.http;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import io.netty.channel.ChannelHandler;
+import io.netty.handler.codec.string.StringDecoder;
+import io.netty.handler.codec.string.StringEncoder;
+
+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.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
+import org.junit.Test;
+
+public class NettyHttpGetWithInvalidMessageTest extends CamelTestSupport {
+    private static final String REQUEST_STRING = "user: Willem\n" 
+        + "GET http://localhost:8101/test HTTP/1.1\n" + "another: value\n Host: localhost\n";
+    private int port1;
+   
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        
+        // setup the String encoder and decoder 
+       
+        StringDecoder stringDecoder = new StringDecoder();
+        registry.bind("string-decoder", stringDecoder);
+
+        StringEncoder stringEncoder = new StringEncoder();
+        registry.bind("string-encoder", stringEncoder);
+
+        List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
+        decoders.add(stringDecoder);
+
+        List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
+        encoders.add(stringEncoder);
+
+        registry.bind("encoders", encoders);
+        registry.bind("decoders", decoders);
+        
+        return registry;
+    }
+    
+    @Test
+    public void testNettyHttpServer() throws Exception {
+        invokeService(8100);
+    }
+    
+    //@Test
+    public void testJettyHttpServer() throws Exception {
+        invokeService(port1);
+    }
+    
+    private void invokeService(int port) {
+        Exchange out = template.request("netty4:tcp://localhost:" + port + "?encoders=#encoders&decoders=#decoders&sync=true" , new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(REQUEST_STRING);
+            }
+        });
+
+        assertNotNull(out);
+        String result = out.getOut().getBody(String.class);
+        assertNotNull(result);
+        assertTrue("We should get the 404 response.", result.indexOf("404 Not Found") > 0);
+        
+    }
+    
+
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                port1 = AvailablePortFinder.getNextAvailable(8100);
+                
+               // set up a netty http proxy
+                from("netty4-http:http://localhost:" + port1 + "/test")
+                    .transform().simple("Bye ${header.user}.");
+          
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamAsExchangeHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamAsExchangeHeaderTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamAsExchangeHeaderTest.java
new file mode 100644
index 0000000..b89070b
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamAsExchangeHeaderTest.java
@@ -0,0 +1,127 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class NettyHttpGetWithParamAsExchangeHeaderTest extends BaseNettyTest {
+
+    private String serverUri = "netty4-http:http://localhost:" + getPort() + "/myservice?urlDecodeHeaders=true";
+
+    @Test
+    public void testHttpGetWithParamsViaURI() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("one", "einz");
+        mock.expectedHeaderReceived("two", "twei");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        template.requestBody(serverUri + "&one=einz&two=twei", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpGetWithUTF8EncodedParamsViaURI() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("message", "Keine g\u00FCltige GPS-Daten!");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        template.requestBody(serverUri + "&message=Keine%20g%C3%BCltige%20GPS-Daten!", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    @Ignore
+    public void testHttpGetWithISO8859EncodedParamsViaURI() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("message", "Keine g\u00C6ltige GPS-Daten!");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        template.requestBody(serverUri + "&message=Keine+g%C6ltige+GPS-Daten%21", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpGetWithSpaceInParams() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("message", " World");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        // parameter starts with a space using %2B as decimal encoded
+        template.requestBody(serverUri + "&message=%2BWorld", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpGetWithSpaceAsPlusInParams() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("message", " World");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        // parameter starts with a space using + decoded
+        template.requestBody(serverUri + "&message=+World", null, Object.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    @Ignore("HTTP_QUERY not yet supported")
+    public void testHttpGetWithParamsViaHeader() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("one", "uno");
+        mock.expectedHeaderReceived("two", "dos");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
+
+        template.requestBodyAndHeader(serverUri, null, Exchange.HTTP_QUERY, "one=uno&two=dos");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpPost() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedBodiesReceived("Hello World");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+        template.requestBody(serverUri, "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(serverUri).to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
new file mode 100644
index 0000000..9e31337
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpGetWithParamTest.java
@@ -0,0 +1,78 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class NettyHttpGetWithParamTest extends BaseNettyTest {
+
+    private String serverUri = "netty4-http:http://localhost:" + getPort() + "/myservice";
+    private MyParamsProcessor processor = new MyParamsProcessor();
+
+    @Test
+    public void testHttpGetWithParamsViaURI() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedHeaderReceived("one", "eins");
+        mock.expectedHeaderReceived("two", "zwei");
+
+        template.requestBody(serverUri + "?one=uno&two=dos", (Object) null);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    @Ignore("HTTP_QUERY not supported")
+    public void testHttpGetWithParamsViaHeader() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedHeaderReceived("one", "eins");
+        mock.expectedHeaderReceived("two", "zwei");
+
+        template.requestBodyAndHeader(serverUri, null, Exchange.HTTP_QUERY, "one=uno&two=dos");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from(serverUri).process(processor).to("mock:result");
+            }
+        };
+    }
+
+    private static class MyParamsProcessor implements Processor {
+        public void process(Exchange exchange) throws Exception {
+            NettyHttpMessage message = exchange.getIn(NettyHttpMessage.class);
+            assertNotNull(message.getHttpRequest());
+
+            String uri = message.getHttpRequest().getUri();
+            assertTrue(uri.endsWith("one=uno&two=dos"));
+
+            exchange.getOut().setBody("Bye World");
+            exchange.getOut().setHeader("one", "eins");
+            exchange.getOut().setHeader("two", "zwei");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHandle404Test.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHandle404Test.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHandle404Test.java
new file mode 100644
index 0000000..385ecef
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHandle404Test.java
@@ -0,0 +1,92 @@
+/**
+ * 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.netty4.http;
+
+import java.nio.charset.Charset;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.junit.Test;
+
+public class NettyHttpHandle404Test extends BaseNettyTest {
+
+    public String getProducerUrl() {
+        return "netty4-http: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();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // 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(NettyHttpOperationFailedException.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
+                                NettyHttpOperationFailedException cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, NettyHttpOperationFailedException.class);
+                                exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, cause.getStatusCode());
+                                exchange.getOut().setBody(cause.getHttpContent().content().toString(Charset.defaultCharset()));
+                            }
+                        })
+                        .end();
+
+
+                // this is our jetty server where we simulate the 404
+                from("netty4-http: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/db88eeda/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderCaseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderCaseTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderCaseTest.java
new file mode 100644
index 0000000..a92f4e4
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderCaseTest.java
@@ -0,0 +1,73 @@
+/**
+ * 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.netty4.http;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.junit.Test;
+
+public class NettyHttpHeaderCaseTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpHeaderCase() throws Exception {
+        HttpClient client = new HttpClient();
+        HttpMethod method = new PostMethod("http://localhost:" + getPort() + "/myapp/mytest");
+
+        method.setRequestHeader("clientHeader", "fooBAR");
+        method.setRequestHeader("OTHER", "123");
+        method.setRequestHeader("beer", "Carlsberg");
+
+        client.executeMethod(method);
+
+        assertEquals("Bye World", method.getResponseBodyAsString());
+        assertEquals("aBc123", method.getResponseHeader("MyCaseHeader").getValue());
+        assertEquals("456DEf", method.getResponseHeader("otherCaseHeader").getValue());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                from("netty4-http:http://localhost:{{port}}/myapp/mytest").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+
+                        // headers received should be in case as well
+                        Map<String, Object> map = new LinkedHashMap<String, Object>();
+                        map.putAll(exchange.getIn().getHeaders());
+
+                        assertEquals("123", map.get("OTHER"));
+                        assertEquals(null, map.get("other"));
+                        assertEquals("Carlsberg", map.get("beer"));
+                        assertEquals(null, map.get("Beer"));
+
+                        exchange.getOut().setBody("Bye World");
+                        exchange.getOut().setHeader("MyCaseHeader", "aBc123");
+                        exchange.getOut().setHeader("otherCaseHeader", "456DEf");
+                    }
+                });
+            }
+        };
+    }
+
+}