http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpFilterCamelHeadersTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpFilterCamelHeadersTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpFilterCamelHeadersTest.java
new file mode 100644
index 0000000..47f0dd5
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/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.netty.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("netty-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("netty-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/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderCaseTest.java
new file mode 100644
index 0000000..2b89be2
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/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.netty.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("netty-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");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpMapHeadersFalseTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpMapHeadersFalseTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpMapHeadersFalseTest.java
new file mode 100644
index 0000000..28498e9
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpMapHeadersFalseTest.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.netty.http;
+
+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 NettyHttpMapHeadersFalseTest 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("netty-http:http://localhost:{{port}}/myapp/mytest?mapHeaders=false";).process(new
 Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        // these headers is not mapped
+                        assertNull(exchange.getIn().getHeader("clientHeader"));
+                        assertNull(exchange.getIn().getHeader("OTHER"));
+                        assertNull(exchange.getIn().getHeader("beer"));
+
+                        // but we can find them in the http request from netty
+                        assertEquals("fooBAR", 
exchange.getIn(NettyHttpMessage.class).getHttpRequest().getHeader("clientHeader"));
+                        assertEquals("123", 
exchange.getIn(NettyHttpMessage.class).getHttpRequest().getHeader("OTHER"));
+                        assertEquals("Carlsberg", 
exchange.getIn(NettyHttpMessage.class).getHttpRequest().getHeader("beer"));
+
+                        exchange.getOut().setBody("Bye World");
+                        exchange.getOut().setHeader("MyCaseHeader", "aBc123");
+                        exchange.getOut().setHeader("otherCaseHeader", 
"456DEf");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerConcurrentTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerConcurrentTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerConcurrentTest.java
new file mode 100644
index 0000000..7f54ddf
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerConcurrentTest.java
@@ -0,0 +1,85 @@
+/**
+ * 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.netty.http;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpProducerConcurrentTest extends BaseNettyTest {
+
+    @Test
+    public void testNoConcurrentProducers() throws Exception {
+        doSendMessages(1, 1);
+    }
+
+    @Test
+    public void testConcurrentProducers() throws Exception {
+        doSendMessages(10, 5);
+    }
+
+    private void doSendMessages(int files, int poolSize) throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(files);
+        getMockEndpoint("mock:result").assertNoDuplicates(body());
+
+        ExecutorService executor = Executors.newFixedThreadPool(poolSize);
+        Map<Integer, Future<String>> responses = new 
ConcurrentHashMap<Integer, Future<String>>();
+        for (int i = 0; i < files; i++) {
+            final int index = i;
+            Future<String> out = executor.submit(new Callable<String>() {
+                public String call() throws Exception {
+                    return 
template.requestBody("netty-http:http://localhost:{{port}}/echo";, "" + index, 
String.class);
+                }
+            });
+            responses.put(index, out);
+        }
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals(files, responses.size());
+
+        // get all responses
+        Set<Object> unique = new HashSet<Object>();
+        for (Future<String> future : responses.values()) {
+            unique.add(future.get());
+        }
+
+        // should be 'files' unique responses
+        assertEquals("Should be " + files + " unique responses", files, 
unique.size());
+        executor.shutdownNow();
+    }
+
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // expose a echo service
+                from("netty-http:http://localhost:{{port}}/echo";)
+                        .transform(body().append(body())).to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerKeepAliveTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerKeepAliveTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerKeepAliveTest.java
new file mode 100644
index 0000000..ad018f0
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerKeepAliveTest.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.netty.http;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpProducerKeepAliveTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpKeepAlive() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World", 
"Hello Again");
+
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo?keepAlive=true";, 
"Hello World", String.class);
+        assertEquals("Bye World", out);
+
+        out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo?keepAlive=true";, 
"Hello Again", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpKeepAliveFalse() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World", 
"Hello Again");
+
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo?keepAlive=false";,
 "Hello World", String.class);
+        assertEquals("Bye World", out);
+
+        out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo?keepAlive=false";,
 "Hello Again", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-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/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSendEmptyHeaderTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSendEmptyHeaderTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSendEmptyHeaderTest.java
new file mode 100644
index 0000000..7212c82
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSendEmptyHeaderTest.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.netty.http;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class NettyHttpProducerSendEmptyHeaderTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpProducerSendEmptyHeader() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("foo", "");
+
+        
template.sendBodyAndHeader("netty-http:http://localhost:{{port}}/myapp/mytest";, 
"Hello World", "foo", "");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://localhost:{{port}}/myapp/mytest";)
+                        .convertBodyTo(String.class)
+                        .to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSimpleGetTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSimpleGetTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSimpleGetTest.java
new file mode 100644
index 0000000..c5e7430
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerSimpleGetTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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.netty.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpProducerSimpleGetTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpSimple() throws Exception {
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, 
"GET");
+
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo";, null, 
String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpSimpleHeader() throws Exception {
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, 
"GET");
+
+        String out = 
template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo";, null, 
Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testHttpSimpleHeaderAndBody() throws Exception {
+        // even if we have a body we force it to be GET
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+        
getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, 
"GET");
+
+        String out = 
template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo";, 
"Hello World", Exchange.HTTP_METHOD, "GET", String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-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/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerTwoParametersWithSameKeyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerTwoParametersWithSameKeyTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerTwoParametersWithSameKeyTest.java
new file mode 100644
index 0000000..6b8917e
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerTwoParametersWithSameKeyTest.java
@@ -0,0 +1,100 @@
+/**
+ * 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.netty.http;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpProducerTwoParametersWithSameKeyTest extends 
BaseNettyTest {
+
+    @Test
+    public void testTwoParametersWithSameKey() throws Exception {
+        Exchange out = 
template.request("netty-http:http://localhost:{{port}}/myapp?from=me&to=foo&to=bar";,
 null);
+
+        assertNotNull(out);
+        assertFalse("Should not fail", out.isFailed());
+        assertEquals("OK", out.getOut().getBody(String.class));
+        assertEquals("yes", out.getOut().getHeader("bar"));
+
+        List<?> foo = out.getOut().getHeader("foo", List.class);
+        assertNotNull(foo);
+        assertEquals(2, foo.size());
+        assertEquals("123", foo.get(0));
+        assertEquals("456", foo.get(1));
+    }
+
+    @Test
+    public void testTwoHeadersWithSameKeyHeader() throws Exception {
+        Exchange out = 
template.request("netty-http:http://localhost:{{port}}/myapp";, new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody(null);
+                exchange.getIn().setHeader("from", "me");
+                List<String> list = new ArrayList<String>();
+                list.add("foo");
+                list.add("bar");
+                exchange.getIn().setHeader("to", list);
+            }
+        });
+
+        assertNotNull(out);
+        assertFalse("Should not fail", out.isFailed());
+        assertEquals("OK", out.getOut().getBody(String.class));
+        assertEquals("yes", out.getOut().getHeader("bar"));
+
+        List<?> foo = out.getOut().getHeader("foo", List.class);
+        assertNotNull(foo);
+        assertEquals(2, foo.size());
+        assertEquals("123", foo.get(0));
+        assertEquals("456", foo.get(1));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://localhost:{{port}}/myapp";).process(new 
Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String from = exchange.getIn().getHeader("from", 
String.class);
+                        assertEquals("me", from);
+
+                        List<?> to = exchange.getIn().getHeader("to", 
List.class);
+                        assertNotNull(to);
+                        assertEquals(2, to.size());
+                        assertEquals("foo", to.get(0));
+                        assertEquals("bar", to.get(1));
+
+                        // response
+                        exchange.getOut().setBody("OK");
+                        // use multiple values for the foo header in the reply
+                        List<Integer> list = new ArrayList<Integer>();
+                        list.add(123);
+                        list.add(456);
+                        exchange.getOut().setHeader("foo", list);
+                        exchange.getOut().setHeader("bar", "yes");
+                    }
+                });
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectNoLocationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectNoLocationTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectNoLocationTest.java
new file mode 100644
index 0000000..0005673
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectNoLocationTest.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.netty.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpRedirectNoLocationTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpRedirectNoLocation() throws Exception {
+        try {
+            template.requestBody("netty-http:http://localhost:{{port}}/test";, 
"Hello World", String.class);
+            fail("Should have thrown an exception");
+        } catch (RuntimeCamelException e) {
+            NettyHttpOperationFailedException cause = 
assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause());
+            assertEquals(302, cause.getStatusCode());
+            assertEquals(true, cause.isRedirectError());
+            assertEquals(false, cause.hasRedirectLocation());
+            assertEquals(null, cause.getRedirectLocation());
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://localhost:{{port}}/test";)
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws 
Exception {
+                                
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 302);
+                            }
+                        });
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectTest.java
new file mode 100644
index 0000000..631ed3d
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpRedirectTest.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.netty.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpRedirectTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpRedirect() throws Exception {
+        try {
+            template.requestBody("netty-http:http://localhost:{{port}}/test";, 
"Hello World", String.class);
+            fail("Should have thrown an exception");
+        } catch (RuntimeCamelException e) {
+            NettyHttpOperationFailedException cause = 
assertIsInstanceOf(NettyHttpOperationFailedException.class, e.getCause());
+            assertEquals(301, cause.getStatusCode());
+            assertEquals(true, cause.isRedirectError());
+            assertEquals(true, cause.hasRedirectLocation());
+            assertEquals("http://localhost:"; + getPort() + "/newtest", 
cause.getRedirectLocation());
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://localhost:{{port}}/test";)
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws 
Exception {
+                                
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 301);
+                                exchange.getOut().setHeader("location", 
"http://localhost:"; + getPort() + "/newtest");
+                            }
+                        });
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnDataNotInputStreamConvertableTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnDataNotInputStreamConvertableTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnDataNotInputStreamConvertableTest.java
new file mode 100644
index 0000000..c43a164
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnDataNotInputStreamConvertableTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.netty.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpReturnDataNotInputStreamConvertableTest extends 
BaseNettyTest {
+
+    @Test
+    public void testHttpReturnDataNotInputStreamConvertableTest() throws 
Exception {
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/test";, "Hello 
World", String.class);
+        assertEquals("This is the response", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://localhost:{{port}}/test";)
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws 
Exception {
+                                exchange.getOut().setBody(new 
MyResponseBean());
+                            }
+                        });
+            }
+        };
+    }
+
+    private static class MyResponseBean {
+        @Override
+        public String toString() {
+            return "This is the response";
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnFaultTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnFaultTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnFaultTest.java
new file mode 100644
index 0000000..3943297
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpReturnFaultTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.netty.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class NettyHttpReturnFaultTest extends BaseNettyTest {
+
+    @Test
+    @Ignore
+    public void testHttpFault() throws Exception {
+        Exchange exchange = 
template.request("netty-http:http://localhost:{{port}}/test";, new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Hello World!");
+            }
+
+        });
+        assertTrue(exchange.isFailed());
+        NettyHttpOperationFailedException exception = 
exchange.getException(NettyHttpOperationFailedException.class);
+        assertNotNull(exception);
+        assertEquals(500, exception.getStatusCode());
+        String message = context.getTypeConverter().convertTo(String.class, 
exception.getResponse().getContent());
+        assertEquals("This is a fault", message);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://localhost:{{port}}/test";)
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws 
Exception {
+                                exchange.getOut().setFault(true);
+                                exchange.getOut().setBody("This is a fault");
+                            }
+                        });
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleTest.java
index ee4f099..188f12d 100644
--- 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleTest.java
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleTest.java
@@ -25,7 +25,7 @@ public class NettyHttpSimpleTest extends BaseNettyTest {
     public void testHttpSimple() throws Exception {
         getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
 
-        String out = template.requestBody("http://localhost:{{port}}/foo";, 
"Hello World", String.class);
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo";, "Hello World", 
String.class);
         assertEquals("Bye World", out);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleUriParametersTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleUriParametersTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleUriParametersTest.java
new file mode 100644
index 0000000..2710f71
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimpleUriParametersTest.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.netty.http;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpSimpleUriParametersTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpSimple() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo?name=bar";, 
"Hello World", String.class);
+        assertEquals("Bye bar", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://0.0.0.0:{{port}}/foo";)
+                    .to("mock:input")
+                    .transform().simple("Bye ${header.name}");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpTransferExceptionTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpTransferExceptionTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpTransferExceptionTest.java
new file mode 100644
index 0000000..b25ed09
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpTransferExceptionTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.netty.http;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpTransferExceptionTest extends BaseNettyTest {
+
+    @Test
+    public void testHttpTransferException() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+
+        try {
+            
template.requestBody("netty-http:http://localhost:{{port}}/foo?transferException=true";,
 "Hello World", String.class);
+            fail("Should have failed");
+        } catch (CamelExecutionException e) {
+            IllegalArgumentException cause = 
assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+            assertEquals("Camel cannot do this", cause.getMessage());
+        }
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
from("netty-http:http://0.0.0.0:{{port}}/foo?transferException=true";)
+                    .to("mock:input")
+                    .throwException(new IllegalArgumentException("Camel cannot 
do this"));
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b67f5f90/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyUseRawHttpResponseTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyUseRawHttpResponseTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyUseRawHttpResponseTest.java
index 12215d7..de6b6ad 100644
--- 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyUseRawHttpResponseTest.java
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyUseRawHttpResponseTest.java
@@ -33,7 +33,7 @@ public class NettyUseRawHttpResponseTest extends 
BaseNettyTest {
     public void testAccessHttpRequest() throws Exception {
         getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
 
-        String out = template.requestBody("http://localhost:{{port}}/foo";, 
"Hello World", String.class);
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo";, "Hello World", 
String.class);
         assertEquals("Bye World", out);
 
         assertMockEndpointsSatisfied();

Reply via email to