public class Proxy extends Object
Proxy是一个不可变的对象。
ProxySelector
| Modifier and Type | Class and Description |
|---|---|
static class |
Proxy.Type
代表代理类型。
|
| Modifier and Type | Field and Description |
|---|---|
static Proxy |
NO_PROXY
一个代理设置,代表一个
DIRECT连接,基本上告诉协议处理程序不使用任何代理。
|
| Constructor and Description |
|---|
Proxy(Proxy.Type type, SocketAddress sa)
创建一个表示PROXY连接的条目。
|
public static final Proxy NO_PROXY
DIRECT连接,基本上告诉协议处理程序不使用任何代理。
例如,用于绕过任何其他全局代理设置(如SOCKS)创建套接字:
Socket s = new Socket(Proxy.NO_PROXY);
public Proxy(Proxy.Type type, SocketAddress sa)
使用Proxy.NO_PROXY常量来表示直接连接。
type - 代理人的
Type
sa - 该代理的
SocketAddress
IllegalArgumentException - 当类型和地址不兼容时
public Proxy.Type type()
public SocketAddress address()
null ,如果其为直接连接。
SocketAddress代理的套接字端点的
SocketAddress
public String toString()
DIRECT则从其地址连接“@”和toString()结果。
public final boolean equals(Object obj)
null并且它代表与该对象相同的代理时,结果为true 。
如果SocketAddresses和类型都相等,则两个Proxy实例表示相同的地址。
equals在
Object
obj - 要比较的对象。
true如果对象是一样的;
false否则。
InetSocketAddress.equals(java.lang.Object)
public final int hashCode()
hashCode在
Object
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.