From: Javier G <jav...@ya...> - 2005-07-15 08:20:19
|
Hello, I´m a novice in htmlunit, trying to using it through a corporative proxy. it´s the same error as if proxy authentication were not used. This is the code i´m using, but it always throws UnknowHostException. Thanks in advance! import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.*; import junit.framework.Assert; import java.net.*; import org.apache.commons.httpclient.auth.CredentialsProvider; import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider; ... public void test_auHomePage() throws Exception { final WebClient webClient = new WebClient(); final DefaultCredentialsProvider scp = new DefaultCredentialsProvider(); scp.addProxyCredentials("user", "password","corporative.proxy",8080); webClient.setCredentialsProvider(scp); final URL url = new URL("http://htmlunit.sourceforge.net"); final HtmlPage page = (HtmlPage)webClient.getPage(url); Assert.assertEquals( "htmlunit - Welcome to HtmlUnit", page.getTitleText() ); --------------------------------- Correo Yahoo! Comprueba qué es nuevo, aquí http://correo.yahoo.es |