Module bus.http

Class NullProxySelector

java.lang.Object
java.net.ProxySelector
org.miaixz.bus.http.metric.proxy.NullProxySelector

public class NullProxySelector extends ProxySelector
A ProxySelector that always returns Proxy.NO_PROXY. This can be used to effectively disable proxy usage.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • NullProxySelector

      public NullProxySelector()
  • Method Details

    • select

      public List<Proxy> select(URI uri)
      Selects a list of proxies to use for a given URI. This implementation always returns a list containing only Proxy.NO_PROXY.
      Specified by:
      select in class ProxySelector
      Parameters:
      uri - The URI to select a proxy for.
      Returns:
      A list containing only Proxy.NO_PROXY.
      Throws:
      IllegalArgumentException - if the URI is null.
    • connectFailed

      public void connectFailed(URI uri, SocketAddress socketAddress, IOException ex)
      Called to indicate that a connection to a proxy has failed. This implementation does nothing.
      Specified by:
      connectFailed in class ProxySelector
      Parameters:
      uri - The URI that the proxy failed to connect to.
      socketAddress - The address of the proxy that failed.
      ex - The I/O exception that occurred.