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