@Test public void override_hostOnly() throws Exception { final String overrideHostWithoutPort = "10.99.99.99"; final int defaultPort = 80; ProxyDetectorImpl proxyDetector = new ProxyDetectorImpl( proxySelectorSupplier, authenticator, overrideHostWithoutPort); ProxyParameters detected = proxyDetector.proxyFor(destination); assertNotNull(detected); assertEquals( new ProxyParameters( new InetSocketAddress( InetAddress.getByName(overrideHostWithoutPort), defaultPort), NO_USER, NO_PW), detected); }
@Nullable @Override public ProxyParameters proxyFor(SocketAddress targetServerAddress) throws IOException { if (override != null) { return override; } if (!(targetServerAddress instanceof InetSocketAddress)) { return null; } return detectProxy((InetSocketAddress) targetServerAddress); }
ProxyDetectorImpl implements ProxyDetector { @Nullable @Override public ProxyParameters proxyFor(SocketAddress targetServerAddress) throws IOException { if (override != null) { return override; } if (!(targetServerAddress instanceof InetSocketAddress)) { return null; } return detectProxy((InetSocketAddress) targetServerAddress); } }
ProxyDetectorImpl implements ProxyDetector { @Nullable @Override public ProxyParameters proxyFor(SocketAddress targetServerAddress) throws IOException { if (override != null) { return override; } if (!(targetServerAddress instanceof InetSocketAddress)) { return null; } return detectProxy((InetSocketAddress) targetServerAddress); } ProxyDetectorImpl(); @VisibleForTesting  ProxyDetectorImpl(
      Supplier<ProxySelector> proxySelector,
      AuthenticationProvider authenticationProvider,
      @Nullable String proxyEnvString); }
ProxyDetectorImpl implements ProxyDetector { @Nullable @Override public ProxyParameters proxyFor(SocketAddress targetServerAddress) throws IOException { if (override != null) { return override; } if (!(targetServerAddress instanceof InetSocketAddress)) { return null; } return detectProxy((InetSocketAddress) targetServerAddress); } ProxyDetectorImpl(); @VisibleForTesting  ProxyDetectorImpl(
      Supplier<ProxySelector> proxySelector,
      AuthenticationProvider authenticationProvider,
      @Nullable String proxyEnvString); @Nullable @Override ProxyParameters proxyFor(SocketAddress targetServerAddress); }
ProxyDetectorImpl implements ProxyDetector { @Nullable @Override public ProxyParameters proxyFor(SocketAddress targetServerAddress) throws IOException { if (override != null) { return override; } if (!(targetServerAddress instanceof InetSocketAddress)) { return null; } return detectProxy((InetSocketAddress) targetServerAddress); } ProxyDetectorImpl(); @VisibleForTesting  ProxyDetectorImpl(
      Supplier<ProxySelector> proxySelector,
      AuthenticationProvider authenticationProvider,
      @Nullable String proxyEnvString); @Nullable @Override ProxyParameters proxyFor(SocketAddress targetServerAddress);  }