Module java.base
Package java.net

Class ProxySelector

java.lang.Object
java.net.ProxySelector

public abstract classProxySelectorextendsObject
Selects the proxy server to use, if any, when connecting to the network resource referenced by a URL. A proxy selector is a concrete sub-class of this class and is registered by invoking thesetDefault method. The currently registered proxy selector can be retrieved by callinggetDefault method.

When a proxy selector is registered, for instance, a subclass of URLConnection class should call theselect method for each URL request so that the proxy selector can decide if a direct, or proxied connection should be used. Theselect method returns an iterator over a collection with the preferred connection approach.

If a connection cannot be established to a proxy (PROXY or SOCKS) servers then the caller should call the proxy selector'sconnectFailed method to notify the proxy selector that the proxy server is unavailable.

The default proxy selector does enforce aset of System Properties related to proxy settings.

Since:
1.5