SeleniumServerConfiguration configuration = new SeleniumServerConfiguration();
configuration.setProxyHost("localhost");
configuration.setProxyPort("8888");
configuration.setNonProxyHosts("localhost,mymachine");
SystemEnvHolder env = new SystemEnvHolder();
String proxyHost = System.getProperty("http.proxyHost");
String proxyPort = System.getProperty("http.proxyPort");
String nonProxyHosts = System.getProperty("http.nonProxyHosts");
env.modifyEnvBy(configuration);
Assert.assertEquals("http.proxyHost was set", System.getProperty("http.proxyHost"), "localhost");
Assert.assertEquals("http.proxyPort was set", System.getProperty("http.proxyPort"), "8888");
Assert.assertEquals("http.nonProxyHosts was set", System.getProperty("http.nonProxyHosts"), "localhost,mymachine");
env.restore();
Assert.assertEquals("http.proxyHost was restored", System.getProperty("http.proxyHost"), proxyHost);
Assert.assertEquals("http.proxyPort was restored", System.getProperty("http.proxyPort"), proxyPort);
Assert.assertEquals("http.nonProxyHosts was restored", System.getProperty("http.nonProxyHosts"), nonProxyHosts);
}