加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090228154843/http://developer.android.com:80/reference/java/net/Proxy.html
public class

Proxy

extends Object
java.lang.Object
   ↳ java.net.Proxy

Class Overview

This class is about proxy setting. A proxy contains type, proxy host address information. There are three types of Proxy:

  • Direct type proxy
  • HTTP type proxy
  • SOCKS type proxy
  • A Proxy instance is immutable.

    Summary

    Nested Classes
    public class Proxy.Type The proxy type, includes DIRECT, HTTP and SOCKS
    Constants
    Proxy NO_PROXY Represents Proxy.Type.DIRECT type proxy setting.
    Public Constructors
    Proxy(Proxy.Type type, SocketAddress sa)
    New a Proxy instance.
    Public Methods
    SocketAddress address()
    Gets the proxy address.
    final boolean equals(Object obj)

    Compare obj with current proxy.

    final int hashCode()
    gets the hash code of Proxy.
    String toString()

    Representing string of the proxy.

    Proxy.Type type()
    Gets the proxy type.
    [Expand]
    Inherited Methods
    From class java.lang.Object

    Constants

    public static final Proxy NO_PROXY

    Represents Proxy.Type.DIRECT type proxy setting. It tells protocol handlers not to use any proxy.

    Public Constructors

    public Proxy (Proxy.Type type, SocketAddress sa)

    New a Proxy instance. SocketAddress must NOT be null when type is either Proxy.Type.HTTP or Proxy.Type.SOCKS. For Proxy.Type.DIRECT type proxy, use Proxy.NO_PROXY directly instead of constructing it.

    Parameters
    type proxy type
    sa proxy address
    Throws
    IllegalArgumentException when type is Proxy.Type.DIRECT or SocketAddress is null.

    Public Methods

    public SocketAddress address ()

    Gets the proxy address.

    Returns
    • the proxy address for HTTP and SOCKS type proxy. Returns null for DIRECT type proxy.

    public final boolean equals (Object obj)

    Compare obj with current proxy. Returns false if the obj is not a Proxy object. Returns true if and only if the obj has the same address and type value as current proxy.

    Parameters
    obj Object the object to compare with this object.
    Returns
    • true if obj represents the same proxy. Otherwise, returns false.

    public final int hashCode ()

    gets the hash code of Proxy.

    Returns
    • the hash code of Proxy.
    See Also

    public String toString ()

    Representing string of the proxy. The string consists of type.toString() and address.toString() if type and address are not null.

    Returns
    • representing string of the proxy.

    public Proxy.Type type ()

    Gets the proxy type.

    Returns
    • the proxy type.