2010-09-03 82 views

回答

1
  1. 好吧,如果代理不存在,你將有一個錯誤:

    WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_8, "localhost", 8080); 
    HtmlPage page = webClient.getPage("http://htmlunit.sf.net"); 
    System.out.println(page.asText()); 
    
org.apache.http.conn.HttpHostConnectException: 

Connection to http://localhost:8080 refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:127) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)

  • 如果代理行爲不端,你將有一個不同的頁面比你所期望的
  • +0

    我可以通過嘗試趕上它嗎? – oneat 2010-09-04 07:57:06

    +0

    當然可以,爲什麼不呢? – 2010-09-06 11:07:26

    相關問題