< prev index next >

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

Print this page




 239             ex = new SocketException("Reply from SOCKS server contains bad status");
 240             break;
 241         }
 242         if (ex != null) {
 243             in.close();
 244             out.close();
 245             throw ex;
 246         }
 247     }
 248 
 249     @Override
 250     protected void connect(String host, int port) throws IOException {
 251         connect(new InetSocketAddress(host, port), 0);
 252     }
 253 
 254     @Override
 255     protected void connect(InetAddress address, int port) throws IOException {
 256         connect(new InetSocketAddress(address, port), 0);
 257     }
 258 
 259     @Override
 260     void setSocket(Socket soc) {
 261         delegate.socket = soc;
 262         super.setSocket(soc);
 263     }
 264 
 265     @Override
 266     void setServerSocket(ServerSocket soc) {
 267         throw new InternalError("should not get here");
 268     }
 269 
 270     /**
 271      * Connects the Socks Socket to the specified endpoint. It will first
 272      * connect to the SOCKS proxy and negotiate the access. If the proxy
 273      * grants the connections, then the connect is successful and all
 274      * further traffic will go to the "real" endpoint.
 275      *
 276      * @param   endpoint        the {@code SocketAddress} to connect to.
 277      * @param   timeout         the timeout value in milliseconds
 278      * @throws  IOException     if the connection can't be established.
 279      * @throws  SecurityException if there is a security manager and it
 280      *                          doesn't allow the connection
 281      * @throws  IllegalArgumentException if endpoint is null or a
 282      *          SocketAddress subclass not supported by this socket
 283      */
 284     @Override
 285     protected void connect(SocketAddress endpoint, int timeout) throws IOException {
 286         final long deadlineMillis;
 287 
 288         if (timeout == 0) {
 289             deadlineMillis = 0L;




 239             ex = new SocketException("Reply from SOCKS server contains bad status");
 240             break;
 241         }
 242         if (ex != null) {
 243             in.close();
 244             out.close();
 245             throw ex;
 246         }
 247     }
 248 
 249     @Override
 250     protected void connect(String host, int port) throws IOException {
 251         connect(new InetSocketAddress(host, port), 0);
 252     }
 253 
 254     @Override
 255     protected void connect(InetAddress address, int port) throws IOException {
 256         connect(new InetSocketAddress(address, port), 0);
 257     }
 258 











 259     /**
 260      * Connects the Socks Socket to the specified endpoint. It will first
 261      * connect to the SOCKS proxy and negotiate the access. If the proxy
 262      * grants the connections, then the connect is successful and all
 263      * further traffic will go to the "real" endpoint.
 264      *
 265      * @param   endpoint        the {@code SocketAddress} to connect to.
 266      * @param   timeout         the timeout value in milliseconds
 267      * @throws  IOException     if the connection can't be established.
 268      * @throws  SecurityException if there is a security manager and it
 269      *                          doesn't allow the connection
 270      * @throws  IllegalArgumentException if endpoint is null or a
 271      *          SocketAddress subclass not supported by this socket
 272      */
 273     @Override
 274     protected void connect(SocketAddress endpoint, int timeout) throws IOException {
 275         final long deadlineMillis;
 276 
 277         if (timeout == 0) {
 278             deadlineMillis = 0L;


< prev index next >