Name

ProxySelector

Synopsis

An implementation of this abstract class can be used to automatically select one or more Proxy objects to use to connect to a specified URL. Install an implementation of this class with the setDefault( ) method. URLConnection implementations use the installed ProxySelector, if there is one, and call select( ) to obtain a list of suitable Proxy objects for the connection. If a URLConnection cannot contact the proxy server specified in a Proxy object, it calls the connectFailed( ) method to notify the ProxySelector object of the failure.

This class is intended to be implemented by advanced users of java.net and is not for casual use.

public abstract class ProxySelector {
// Public Constructors
     public ProxySelector( );  
// Public Class Methods
     public static ProxySelector getDefault( );  
     public static void setDefault(ProxySelector ps);  
// Public Instance Methods
     public abstract void connectFailed(URI uri, SocketAddress sa, 
java.io.IOException ioe);  
     public abstract java.util.List<java.net.Proxy> select(URI uri);  
}

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.