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 2012/09/12 10:58:59 UTC

svn commit: r1383858 - /camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java

Author: ningjiang
Date: Wed Sep 12 08:58:58 2012
New Revision: 1383858

URL: http://svn.apache.org/viewvc?rev=1383858&view=rev
Log:
CAMEL-5595 added unit test for it

Modified:
    camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java

Modified: camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java?rev=1383858&r1=1383857&r2=1383858&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java (original)
+++ camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java Wed Sep 12 08:58:58 2012
@@ -104,6 +104,26 @@ public class HttpProxyServerTest extends
 
         assertEquals("Should get the same EndpointKey", http1.getEndpointKey(), http2.getEndpointKey());
     }
+    
+    @Test
+    public void testhttpGetProxyScheme() throws Exception {
+        context.getProperties().put("http.proxyHost", "myProxy");
+        context.getProperties().put("http.proxyPort", "1234");
+        context.getProperties().put("http.proxyScheme", "http");
+        try {
+            HttpEndpoint http1 = context.getEndpoint("https4://www.google.com", HttpEndpoint.class);
+            
+            HttpClient client1 = http1.createHttpClient();
+            HttpHost proxy1 = (HttpHost)client1.getParams().getParameter(ConnRoutePNames.DEFAULT_PROXY);
+            assertEquals("myProxy", proxy1.getHostName());
+            assertEquals(1234, proxy1.getPort());
+            assertEquals("http", proxy1.getSchemeName());
+        } finally {
+            context.getProperties().remove("http.proxyHost");
+            context.getProperties().remove("http.proxyPort");
+            context.getProperties().remove("http.proxyScheme");
+        }
+    }
 
     @Test
     public void httpGetWithProxyAndWithoutUser() throws Exception {