StandardWidgetToolkitProvider extends Provider { static void relayNetworkProperties(final List<String> command) { final List<String> httpProxyHostProps = Arrays.asList("https.proxyHost", "http.proxyHost", "network.proxy_host"); final String proxyHost = getFirstSetProperty(httpProxyHostProps); if (!StringHelper.isNullOrEmpty(proxyHost)) { command.add("-Dnetwork.proxy_host=" + proxyHost); } final List<String> httpProxyPortProps = Arrays.asList("https.proxyPort", "http.proxyPort", "network.proxy_port"); final String proxyPort = getFirstSetProperty(httpProxyPortProps); if (!StringHelper.isNullOrEmpty(proxyPort)) { command.add("-Dnetwork.proxy_port=" + proxyPort); } } protected  StandardWidgetToolkitProvider(); static String getDefaultSwtJarPath(); @Override List<String> checkRequirements(); @Override void augmentProcessParameters(final List<String> command, final List<String> classPath); static final String SWT_RUNTIME_JAR_OVERRIDE; }
@Test public void relayJavaStandardNetworkProxySettings() { System.setProperty("network.proxy_host", "127.0.0.1"); System.setProperty("network.proxy_port", "1111"); System.setProperty("http.proxyHost", "localhost"); System.setProperty("http.proxyPort", "3333"); final List<String> command = new ArrayList<String>(); StandardWidgetToolkitProvider.relayNetworkProperties(command); assertEquals(2, command.size()); assertTrue(hasExpectedOption("-Dnetwork.proxy_host=localhost", command)); assertTrue(hasExpectedOption("-Dnetwork.proxy_port=3333", command)); System.setProperty("https.proxyHost", "0.0.0.0"); System.setProperty("https.proxyPort", "8888"); command.clear(); StandardWidgetToolkitProvider.relayNetworkProperties(command); assertEquals(2, command.size()); assertTrue(hasExpectedOption("-Dnetwork.proxy_host=0.0.0.0", command)); assertTrue(hasExpectedOption("-Dnetwork.proxy_port=8888", command)); }
@Test public void relaySwtNetworkProxySettings() { System.setProperty("network.proxy_host", "127.0.0.1"); System.setProperty("network.proxy_port", "1111"); final List<String> command = new ArrayList<String>(); StandardWidgetToolkitProvider.relayNetworkProperties(command); assertEquals(2, command.size()); assertTrue(hasExpectedOption("-Dnetwork.proxy_host=127.0.0.1", command)); assertTrue(hasExpectedOption("-Dnetwork.proxy_port=1111", command)); }