src/share/classes/java/net/SocksSocketImpl.java

Print this page




 627         case 93:
 628             ex = new SocketException("SOCKS authentication failed");
 629             break;
 630         default:
 631             ex = new SocketException("Reply from SOCKS server contains bad status");
 632             break;
 633         }
 634         if (ex != null) {
 635             in.close();
 636             out.close();
 637             throw ex;
 638         }
 639 
 640     }
 641 
 642     /**
 643      * Sends the Bind request to the SOCKS proxy. In the SOCKS protocol, bind
 644      * means "accept incoming connection from", so the SocketAddress is the
 645      * the one of the host we do accept connection from.
 646      *
 647      * @param      addr   the Socket address of the remote host.
 648      * @exception  IOException  if an I/O error occurs when binding this socket.
 649      */
 650     protected synchronized void socksBind(InetSocketAddress saddr) throws IOException {
 651         if (socket != null) {
 652             // this is a client socket, not a server socket, don't
 653             // call the SOCKS proxy for a bind!
 654             return;
 655         }
 656 
 657         // Connects to the SOCKS server
 658 
 659         if (server == null) {
 660             // This is the general case
 661             // server is not null only when the socket was created with a
 662             // specified proxy in which case it does bypass the ProxySelector
 663             ProxySelector sel = java.security.AccessController.doPrivileged(
 664                 new java.security.PrivilegedAction<ProxySelector>() {
 665                     public ProxySelector run() {
 666                             return ProxySelector.getDefault();
 667                         }




 627         case 93:
 628             ex = new SocketException("SOCKS authentication failed");
 629             break;
 630         default:
 631             ex = new SocketException("Reply from SOCKS server contains bad status");
 632             break;
 633         }
 634         if (ex != null) {
 635             in.close();
 636             out.close();
 637             throw ex;
 638         }
 639 
 640     }
 641 
 642     /**
 643      * Sends the Bind request to the SOCKS proxy. In the SOCKS protocol, bind
 644      * means "accept incoming connection from", so the SocketAddress is the
 645      * the one of the host we do accept connection from.
 646      *
 647      * @param      saddr   the Socket address of the remote host.
 648      * @exception  IOException  if an I/O error occurs when binding this socket.
 649      */
 650     protected synchronized void socksBind(InetSocketAddress saddr) throws IOException {
 651         if (socket != null) {
 652             // this is a client socket, not a server socket, don't
 653             // call the SOCKS proxy for a bind!
 654             return;
 655         }
 656 
 657         // Connects to the SOCKS server
 658 
 659         if (server == null) {
 660             // This is the general case
 661             // server is not null only when the socket was created with a
 662             // specified proxy in which case it does bypass the ProxySelector
 663             ProxySelector sel = java.security.AccessController.doPrivileged(
 664                 new java.security.PrivilegedAction<ProxySelector>() {
 665                     public ProxySelector run() {
 666                             return ProxySelector.getDefault();
 667                         }