Beispiel #1
0
 /**
  * Initialize proxy chain.
  *
  * @throws SocketException If a SOCKS protocol error occurred.
  * @throws IOException If an I/O error occurred.
  */
 private void initProxyChain() throws SocketException, IOException {
   List<SocksProxy> proxyChain = new ArrayList<SocksProxy>();
   SocksProxy temp = proxy;
   while (temp.getChainProxy() != null) {
     temp.getChainProxy().setProxySocket(proxySocket);
     proxyChain.add(temp.getChainProxy());
     temp = temp.getChainProxy();
   }
   logger.debug("Proxy chain has:{} proxy", proxyChain.size());
   if (proxyChain.size() > 0) {
     SocksProxy pre = proxy;
     for (int i = 0; i < proxyChain.size(); i++) {
       SocksProxy chain = proxyChain.get(i);
       pre.requestConnect(chain.getInetAddress(), chain.getPort());
       proxy.getChainProxy().buildConnection();
       pre = chain;
     }
   }
 }