RouteInfo.LayerType, RouteInfo.TunnelType
Constructor and Description |
---|
RouteTracker(HttpHost target,
InetAddress local)
Creates a new route tracker.
|
RouteTracker(HttpRoute route)
Creates a new tracker for the given route.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates and returns a copy of this object.
|
void |
connectProxy(HttpHost proxy,
boolean secure)
Tracks connecting to the first proxy.
|
void |
connectTarget(boolean secure)
Tracks connecting to the target.
|
boolean |
equals(Object o)
Compares this tracked route to another.
|
int |
getHopCount()
Obtains the number of hops in this route.
|
HttpHost |
getHopTarget(int hop)
Obtains the target of a hop in this route.
|
RouteInfo.LayerType |
getLayerType()
Obtains the layering type of this route.
|
InetAddress |
getLocalAddress()
Obtains the local address to connect from.
|
HttpHost |
getProxyHost()
Obtains the first proxy host.
|
HttpHost |
getTargetHost()
Obtains the target host.
|
RouteInfo.TunnelType |
getTunnelType()
Obtains the tunnel type of this route.
|
int |
hashCode()
Generates a hash code for this tracked route.
|
boolean |
isConnected() |
boolean |
isLayered()
Checks whether this route includes a layered protocol.
|
boolean |
isSecure()
Checks whether this route is secure.
|
boolean |
isTunnelled()
Checks whether this route is tunnelled through a proxy.
|
void |
layerProtocol(boolean secure)
Tracks layering a protocol.
|
void |
reset() |
HttpRoute |
toRoute()
Obtains the tracked route.
|
String |
toString()
Obtains a description of the tracked route.
|
void |
tunnelProxy(HttpHost proxy,
boolean secure)
Tracks tunnelling to a proxy in a proxy chain.
|
void |
tunnelTarget(boolean secure)
Tracks tunnelling to the target.
|
public RouteTracker(HttpHost target, InetAddress local)
target
- the host to which to routelocal
- the local address to route from, or
null
for the defaultpublic RouteTracker(HttpRoute route)
route
- the route to trackpublic Object clone() throws CloneNotSupportedException
Object
x
, the expression: will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true
, but these are not absolute requirements. While it is
typically the case that: will bex.clone().equals(x)
true
, this is not an absolute requirement.
By convention, the returned object should be obtained by calling super.clone
. If a class
and all of its superclasses (except Object
) obey this convention, it will be the case
that x.clone().getClass() == x.getClass()
.
By convention, the object returned by this method should be independent of this object (which is
being cloned). To achieve this independence, it may be necessary to modify one or more fields of
the object returned by super.clone
before returning it. Typically, this means copying any
mutable objects that comprise the internal "deep structure" of the object being cloned and
replacing the references to these objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually the case that no fields
in the object returned by super.clone
need to be modified.
The method clone
for class Object
performs a specific cloning operation. First,
if the class of this object does not implement the interface Cloneable
, then a
CloneNotSupportedException
is thrown. Note that all arrays are considered to implement
the interface Cloneable
and that the return type of the clone
method of an array
type T[]
is T[]
where T is any reference or primitive type. Otherwise, this
method creates a new instance of the class of this object and initializes all its fields with
exactly the contents of the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of
this object, not a "deep copy" operation.
The class Object
does not itself implement the interface Cloneable
, so calling
the clone
method on an object whose class is Object
will result in throwing an
exception at run time.
clone
in class Object
CloneNotSupportedException
- if the object's class does not support the Cloneable
interface. Subclasses
that override the clone
method can also throw this exception to indicate that
an instance cannot be cloned.Cloneable
public final void connectProxy(HttpHost proxy, boolean secure)
proxy
- the proxy connected tosecure
- true
if the route is secure,
false
otherwisepublic final void connectTarget(boolean secure)
secure
- true
if the route is secure,
false
otherwisepublic final boolean equals(Object o)
equals
in class Object
o
- the object to compare withtrue
if the argument is the same tracked route,
false
Object.hashCode()
,
HashMap
public final int getHopCount()
RouteInfo
getHopCount
in interface RouteInfo
public final HttpHost getHopTarget(int hop)
RouteInfo
target host
,
the target of previous hops is the respective proxy in the chain.
For a route through exactly one proxy, target of hop 0 is the proxy
and target of hop 1 is the target host.getHopTarget
in interface RouteInfo
hop
- index of the hop for which to get the target,
0 for firstpublic final RouteInfo.LayerType getLayerType()
RouteInfo
getLayerType
in interface RouteInfo
public final InetAddress getLocalAddress()
RouteInfo
getLocalAddress
in interface RouteInfo
null
public final HttpHost getProxyHost()
RouteInfo
getProxyHost
in interface RouteInfo
null
if this route is directpublic final HttpHost getTargetHost()
RouteInfo
getTargetHost
in interface RouteInfo
public final RouteInfo.TunnelType getTunnelType()
RouteInfo
getTunnelType
in interface RouteInfo
public final int hashCode()
toRoute
to obtain an
unmodifiable representation of the tracked route.hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public final boolean isConnected()
public final boolean isLayered()
RouteInfo
public final boolean isSecure()
RouteInfo
public final boolean isTunnelled()
RouteInfo
isTunnelled
in interface RouteInfo
true
if tunnelled end-to-end through at least
one proxy,
false
otherwisepublic final void layerProtocol(boolean secure)
secure
- true
if the route is secure,
false
otherwisepublic void reset()
public final HttpRoute toRoute()
connected
.
If not connected, nothing has been tracked so far.null
if nothing has been tracked so farpublic final String toString()
public final void tunnelProxy(HttpHost proxy, boolean secure)
proxy
- the proxy tunnelled tosecure
- true
if the route is secure,
false
otherwisepublic final void tunnelTarget(boolean secure)
secure
- true
if the route is secure,
false
otherwise