XicidailiProxyListPageParser implements ProxyListPageParser { @Override public List<Proxy> parse(String hmtl) { Document document = Jsoup.parse(hmtl); Elements elements = document.select("table[id=ip_list] tr[class]"); List<Proxy> proxyList = new ArrayList<>(elements.size()); for (Element element : elements){ String ip = element.select("td:eq(1)").first().text(); String port = element.select("td:eq(2)").first().text(); String isAnonymous = element.select("td:eq(4)").first().text(); if(!anonymousFlag || isAnonymous.contains("匿")){ proxyList.add(new Proxy(ip, Integer.valueOf(port), Constants.TIME_INTERVAL)); } } return proxyList; }  @Override List<Proxy> parse(String hmtl);  }
@Test public void parse() throws ExecutionException, InterruptedException { SimpleHttpClient simpleHttpClient = new SimpleHttpClient(null); String r = simpleHttpClient.get("http: XicidailiProxyListPageParser pageParser = new XicidailiProxyListPageParser(); List<Proxy> proxyList =pageParser.parse(r); Assert.assertTrue(proxyList.size() > 1); }