jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java
changeset 29112 df7e4edb6566
parent 25859 3317bb8137f4
child 29986 97167d851fc4
equal deleted inserted replaced
29111:e9103f166a4a 29112:df7e4edb6566
   386                 super.connect(epoint, remainingMillis(deadlineMillis));
   386                 super.connect(epoint, remainingMillis(deadlineMillis));
   387                 return;
   387                 return;
   388             }
   388             }
   389             while (iProxy.hasNext()) {
   389             while (iProxy.hasNext()) {
   390                 p = iProxy.next();
   390                 p = iProxy.next();
   391                 if (p == null || p == Proxy.NO_PROXY) {
   391                 if (p == null || p.type() != Proxy.Type.SOCKS) {
   392                     super.connect(epoint, remainingMillis(deadlineMillis));
   392                     super.connect(epoint, remainingMillis(deadlineMillis));
   393                     return;
   393                     return;
   394                 }
   394                 }
   395                 if (p.type() != Proxy.Type.SOCKS)
   395 
   396                     throw new SocketException("Unknown proxy type : " + p.type());
       
   397                 if (!(p.address() instanceof InetSocketAddress))
   396                 if (!(p.address() instanceof InetSocketAddress))
   398                     throw new SocketException("Unknow address type for proxy: " + p);
   397                     throw new SocketException("Unknown address type for proxy: " + p);
   399                 // Use getHostString() to avoid reverse lookups
   398                 // Use getHostString() to avoid reverse lookups
   400                 server = ((InetSocketAddress) p.address()).getHostString();
   399                 server = ((InetSocketAddress) p.address()).getHostString();
   401                 serverPort = ((InetSocketAddress) p.address()).getPort();
   400                 serverPort = ((InetSocketAddress) p.address()).getPort();
   402                 if (p instanceof SocksProxy) {
   401                 if (p instanceof SocksProxy) {
   403                     if (((SocksProxy)p).protocolVersion() == 4) {
   402                     if (((SocksProxy)p).protocolVersion() == 4) {
   705             if (iProxy == null || !(iProxy.hasNext())) {
   704             if (iProxy == null || !(iProxy.hasNext())) {
   706                 return;
   705                 return;
   707             }
   706             }
   708             while (iProxy.hasNext()) {
   707             while (iProxy.hasNext()) {
   709                 p = iProxy.next();
   708                 p = iProxy.next();
   710                 if (p == null || p == Proxy.NO_PROXY) {
   709                 if (p == null || p.type() != Proxy.Type.SOCKS) {
   711                     return;
   710                     return;
   712                 }
   711                 }
   713                 if (p.type() != Proxy.Type.SOCKS)
   712 
   714                     throw new SocketException("Unknown proxy type : " + p.type());
       
   715                 if (!(p.address() instanceof InetSocketAddress))
   713                 if (!(p.address() instanceof InetSocketAddress))
   716                     throw new SocketException("Unknow address type for proxy: " + p);
   714                     throw new SocketException("Unknown address type for proxy: " + p);
   717                 // Use getHostString() to avoid reverse lookups
   715                 // Use getHostString() to avoid reverse lookups
   718                 server = ((InetSocketAddress) p.address()).getHostString();
   716                 server = ((InetSocketAddress) p.address()).getHostString();
   719                 serverPort = ((InetSocketAddress) p.address()).getPort();
   717                 serverPort = ((InetSocketAddress) p.address()).getPort();
   720                 if (p instanceof SocksProxy) {
   718                 if (p instanceof SocksProxy) {
   721                     if (((SocksProxy)p).protocolVersion() == 4) {
   719                     if (((SocksProxy)p).protocolVersion() == 4) {