jdk/src/share/classes/java/net/Socket.java
changeset 16061 c80133bafef0
parent 10596 39b3a979e600
child 17469 e00a02431a8b
child 18212 22f8c33b0690
--- a/jdk/src/share/classes/java/net/Socket.java	Thu Mar 07 11:32:14 2013 +0800
+++ b/jdk/src/share/classes/java/net/Socket.java	Thu Mar 07 10:07:13 2013 +0000
@@ -117,8 +117,10 @@
         if (proxy == null) {
             throw new IllegalArgumentException("Invalid Proxy");
         }
-        Proxy p = proxy == Proxy.NO_PROXY ? Proxy.NO_PROXY : sun.net.ApplicationProxy.create(proxy);
-        if (p.type() == Proxy.Type.SOCKS) {
+        Proxy p = proxy == Proxy.NO_PROXY ? Proxy.NO_PROXY
+                                          : sun.net.ApplicationProxy.create(proxy);
+        Proxy.Type type = p.type();
+        if (type == Proxy.Type.SOCKS || type == Proxy.Type.HTTP) {
             SecurityManager security = System.getSecurityManager();
             InetSocketAddress epoint = (InetSocketAddress) p.address();
             if (epoint.getAddress() != null) {
@@ -133,7 +135,8 @@
                     security.checkConnect(epoint.getAddress().getHostAddress(),
                                   epoint.getPort());
             }
-            impl = new SocksSocketImpl(p);
+            impl = type == Proxy.Type.SOCKS ? new SocksSocketImpl(p)
+                                            : new HttpConnectSocketImpl(p);
             impl.setSocket(this);
         } else {
             if (p == Proxy.NO_PROXY) {