Interface ProxyDetector
- 
 public interface ProxyDetectorA utility class to detect which proxy, if any, should be used for a givenSocketAddress. This class performs network requests to resolve address names, and should only be used in places that are expected to do IO such as theNameResolver.How Proxies work in gRPCIn order for gRPC to use a proxy, NameResolver,ProxyDetectorand the underlying transport need to work together.The NameResolvershould invoke theProxyDetectorretrieved from theNameResolver.Args.getProxyDetector(), and pass the returnedProxiedSocketAddresstoNameResolver.Listener.onAddresses(java.util.List<io.grpc.EquivalentAddressGroup>, io.grpc.Attributes). The DNS name resolver shipped with gRPC is already doing so.The default ProxyDetectoruses Java's standardProxySelectorandAuthenticatorto detect proxies and authentication credentials and produceHttpConnectProxiedSocketAddress, which is for using an HTTP CONNECT proxy. A customProxyDetectorcan be passed toManagedChannelBuilder.proxyDetector(io.grpc.ProxyDetector).The ProxiedSocketAddressis then handled by the transport. The transport needs to support whatever type ofProxiedSocketAddressreturned byProxyDetector. The Netty transport and the OkHttp transport currently only supportHttpConnectProxiedSocketAddresswhich is returned by the defaultProxyDetector.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description ProxiedSocketAddressproxyFor(SocketAddress targetServerAddress)Given a target address, returns a proxied address if a proxy should be used.
 
- 
- 
- 
Method Detail- 
proxyFor@Nullable ProxiedSocketAddress proxyFor(SocketAddress targetServerAddress) throws IOException Given a target address, returns a proxied address if a proxy should be used. If no proxy should be used, then return value will benull.If the returned ProxiedSocketAddresscontains any address that needs to be resolved locally, it should be resolved before it's returned, and this method throws if unable to resolve it.- Parameters:
- targetServerAddress- the target address, which is generally unresolved, because the proxy will resolve it.
- Throws:
- IOException
 
 
- 
 
-