Search in sources :

Example 11 with ProxySettings

use of com.helger.network.proxy.settings.ProxySettings in project ph-web by phax.

the class ProxyAutoConfigHelperTest method testExplicit.

@Test
public void testExplicit() throws ScriptException {
    assertEquals(new ProxySettings(Proxy.Type.HTTP, "1.2.3.4", 8080), _getResolved("return 'PROXY 1.2.3.4:8080';"));
    assertEquals(ProxySettings.createNoProxySettings(), _getResolved("return isInNetEx('127.0.0.1', '127.0.0.0/16') ? 'DIRECT' : 'PROXY 1.2.3.4:8080';"));
    assertEquals(ProxySettings.createNoProxySettings(), _getResolved("return isInNetEx('127.0.0.1', '127.0.0.0/24') ? 'DIRECT' : 'PROXY 1.2.3.4:8080';"));
    assertEquals(ProxySettings.createNoProxySettings(), _getResolved("return isInNetEx('127.0.1.0', '127.0.0.0/24') ? 'PROXY 1.2.3.4:8080' : 'DIRECT';"));
}
Also used : IProxySettings(com.helger.network.proxy.settings.IProxySettings) ProxySettings(com.helger.network.proxy.settings.ProxySettings) Test(org.junit.Test)

Aggregations

ProxySettings (com.helger.network.proxy.settings.ProxySettings)11 Test (org.junit.Test)8 PasswordAuthentication (java.net.PasswordAuthentication)6 IProxySettings (com.helger.network.proxy.settings.IProxySettings)4 Nullable (javax.annotation.Nullable)2 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)1 Proxy (java.net.Proxy)1 Nonnull (javax.annotation.Nonnull)1