/** * When true, no upstream certificate verification will be performed. <b>This will make it possible for * attackers to MITM communications with the upstream server</b>, so use trustAllServers only when testing. * Calling this method with 'true' will remove any trustSource set with {@link #trustSource(TrustSource)}. * Calling this method with 'false' has no effect unless trustAllServers was previously called with 'true'. * To set a specific TrustSource, use {@link #trustSource(TrustSource)}. */ public Builder trustAllServers(boolean trustAllServers) { if (trustAllServers) { this.trustSource = null; } else { // if the TrustSource was previously removed, restore it to the default. otherwise keep the existing TrustSource. if (this.trustSource == null) { this.trustSource = TrustSource.defaultTrustSource(); } } return this; }
@Override public void setTrustAllServers(boolean trustAllServers) { if (isStarted()) { throw new IllegalStateException("Cannot disable upstream server verification after the proxy has been started"); } if (trustAllServers) { trustSource = null; } else { if (trustSource == null) { trustSource = TrustSource.defaultTrustSource(); } } }
/** * When true, no upstream certificate verification will be performed. <b>This will make it possible for * attackers to MITM communications with the upstream server</b>, so use trustAllServers only when testing. * Calling this method with 'true' will remove any trustSource set with {@link #trustSource(TrustSource)}. * Calling this method with 'false' has no effect unless trustAllServers was previously called with 'true'. * To set a specific TrustSource, use {@link #trustSource(TrustSource)}. */ public Builder trustAllServers(boolean trustAllServers) { if (trustAllServers) { this.trustSource = null; } else { // if the TrustSource was previously removed, restore it to the default. otherwise keep the existing TrustSource. if (this.trustSource == null) { this.trustSource = TrustSource.defaultTrustSource(); } } return this; }
/** * When true, no upstream certificate verification will be performed. <b>This will make it possible for * attackers to MITM communications with the upstream server</b>, so use trustAllServers only when testing. * Calling this method with 'true' will remove any trustSource set with {@link #trustSource(TrustSource)}. * Calling this method with 'false' has no effect unless trustAllServers was previously called with 'true'. * To set a specific TrustSource, use {@link #trustSource(TrustSource)}. */ public Builder trustAllServers(boolean trustAllServers) { if (trustAllServers) { this.trustSource = null; } else { // if the TrustSource was previously removed, restore it to the default. otherwise keep the existing TrustSource. if (this.trustSource == null) { this.trustSource = TrustSource.defaultTrustSource(); } } return this; }
@Override public void setTrustAllServers(boolean trustAllServers) { if (isStarted()) { throw new IllegalStateException("Cannot disable upstream server verification after the proxy has been started"); } if (trustAllServers) { trustSource = null; } else { if (trustSource == null) { trustSource = TrustSource.defaultTrustSource(); } } }
@Override public void setTrustAllServers(boolean trustAllServers) { if (isStarted()) { throw new IllegalStateException("Cannot disable upstream server verification after the proxy has been started"); } if (trustAllServers) { trustSource = null; } else { if (trustSource == null) { trustSource = TrustSource.defaultTrustSource(); } } }
@Override public void setTrustAllServers(boolean trustAllServers) { if (isStarted()) { throw new IllegalStateException("Cannot disable upstream server verification after the proxy has been started"); } if (trustAllServers) { trustSource = null; } else { if (trustSource == null) { trustSource = TrustSource.defaultTrustSource(); } } }
/** * Set Proxy instance for a Browser instance */ protected void setProxy() { if (Configuration.useProxy()) { Proxy proxyServer = new Proxy(); if ("true".equals(Configuration.useZap())) { String zapProxyAddress = String.format( "%s:%s", XMLReader.getValue("zap_proxy.address"), Integer.parseInt(XMLReader.getValue("zap_proxy.port")) ); proxyServer.setHttpProxy(zapProxyAddress); proxyServer.setSslProxy(zapProxyAddress); } else { server = new NetworkTrafficInterceptor(); server.setTrustAllServers(true); server.setConnectTimeout(90, TimeUnit.SECONDS); server.setTrustSource(TrustSource.defaultTrustSource()); server.setMitmDisabled(!Boolean.parseBoolean(Configuration.useMITM())); server.setRequestTimeout(90, TimeUnit.SECONDS); server.enableHarCaptureTypes(CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_HEADERS); server.setUseEcc(true); proxyServer = server.startBrowserMobProxyServer(); } caps.setCapability(CapabilityType.PROXY, proxyServer); } } }