[ Team LiB ] Previous Section Next Section

5.11 Testing Through a Firewall

5.11.1 Problem

You want to test a remote web site, but your development machines are behind a firewall.

5.11.2 Solution

Set the proxySet, proxyHost, and proxyPort system properties.

5.11.3 Discussion

HttpUnit uses java.net.HttpURLConnection, which checks the proxySet system property to determine if it should operate through a proxy server. If this property is set, the proxyHost and proxyPort properties specify the server name and port.

You can set these properties in your unit test method using this code:

System.getProperties(  ).put("proxySet", "true");
System.getProperties(  ).put("proxyHost", "myProxyHostName");
System.getProperties(  ).put("proxyPort", "10000");

5.11.4 See Also

Recipe 3.6 shows how to set system properties using Ant.

    [ Team LiB ] Previous Section Next Section