@Test public void detectProxyForUnresolvedDestination() throws Exception { Proxy proxy = new Proxy(Proxy.Type.HTTP, unresolvedProxy); when(proxySelector.select(any(URI.class))).thenReturn(ImmutableList.of(proxy)); ProxyParameters detected = proxyDetector.proxyFor(destination); assertNotNull(detected); assertEquals(proxyParmeters, 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);  }