示例#1
0
 /// <since>4.2</since>
 public void Reset()
 {
     this.connected  = false;
     this.proxyChain = null;
     this.tunnelled  = RouteInfo.TunnelType.Plain;
     this.layered    = RouteInfo.LayerType.Plain;
     this.secure     = false;
 }
示例#2
0
 /// <summary>Tracks layering a protocol.</summary>
 /// <remarks>Tracks layering a protocol.</remarks>
 /// <param name="secure">
 /// <code>true</code> if the route is secure,
 /// <code>false</code> otherwise
 /// </param>
 public void LayerProtocol(bool secure)
 {
     // it is possible to layer a protocol over a direct connection,
     // although this case is probably not considered elsewhere
     Asserts.Check(this.connected, "No layered protocol unless connected");
     this.layered = RouteInfo.LayerType.Layered;
     this.secure  = secure;
 }
示例#3
0
 /// <summary>Creates a new route tracker.</summary>
 /// <remarks>
 /// Creates a new route tracker.
 /// The target and origin need to be specified at creation time.
 /// </remarks>
 /// <param name="target">the host to which to route</param>
 /// <param name="local">
 /// the local address to route from, or
 /// <code>null</code> for the default
 /// </param>
 public RouteTracker(HttpHost target, IPAddress local)
 {
     // the attributes above are fixed at construction time
     // now follow attributes that indicate the established route
     Args.NotNull(target, "Target host");
     this.targetHost   = target;
     this.localAddress = local;
     this.tunnelled    = RouteInfo.TunnelType.Plain;
     this.layered      = RouteInfo.LayerType.Plain;
 }
示例#4
0
 private HttpRoute(HttpHost target, IPAddress local, IList <HttpHost> proxies, bool
                   secure, RouteInfo.TunnelType tunnelled, RouteInfo.LayerType layered)
 {
     Args.NotNull(target, "Target host");
     this.targetHost   = target;
     this.localAddress = local;
     if (proxies != null && !proxies.IsEmpty())
     {
         this.proxyChain = new AList <HttpHost>(proxies);
     }
     else
     {
         this.proxyChain = null;
     }
     if (tunnelled == RouteInfo.TunnelType.Tunnelled)
     {
         Args.Check(this.proxyChain != null, "Proxy required if tunnelled");
     }
     this.secure    = secure;
     this.tunnelled = tunnelled != null ? tunnelled : RouteInfo.TunnelType.Plain;
     this.layered   = layered != null ? layered : RouteInfo.LayerType.Plain;
 }
示例#5
0
 /// <summary>Creates a new route with at most one proxy.</summary>
 /// <remarks>Creates a new route with at most one proxy.</remarks>
 /// <param name="target">the host to which to route</param>
 /// <param name="local">
 /// the local address to route from, or
 /// <code>null</code> for the default
 /// </param>
 /// <param name="proxy">
 /// the proxy to use, or
 /// <code>null</code> for a direct route
 /// </param>
 /// <param name="secure">
 /// <code>true</code> if the route is (to be) secure,
 /// <code>false</code> otherwise
 /// </param>
 /// <param name="tunnelled">
 /// <code>true</code> if the route is (to be) tunnelled
 /// via the proxy,
 /// <code>false</code> otherwise
 /// </param>
 /// <param name="layered">
 /// <code>true</code> if the route includes a
 /// layered protocol,
 /// <code>false</code> otherwise
 /// </param>
 public HttpRoute(HttpHost target, IPAddress local, HttpHost proxy, bool secure, RouteInfo.TunnelType
                  tunnelled, RouteInfo.LayerType layered) : this(target, local, proxy != null ? Sharpen.Collections
                                                                 .SingletonList(proxy) : null, secure, tunnelled, layered)
 {
 }
示例#6
0
 /// <summary>Creates a new route with all attributes specified explicitly.</summary>
 /// <remarks>Creates a new route with all attributes specified explicitly.</remarks>
 /// <param name="target">the host to which to route</param>
 /// <param name="local">
 /// the local address to route from, or
 /// <code>null</code> for the default
 /// </param>
 /// <param name="proxies">
 /// the proxy chain to use, or
 /// <code>null</code> for a direct route
 /// </param>
 /// <param name="secure">
 /// <code>true</code> if the route is (to be) secure,
 /// <code>false</code> otherwise
 /// </param>
 /// <param name="tunnelled">the tunnel type of this route</param>
 /// <param name="layered">the layering type of this route</param>
 public HttpRoute(HttpHost target, IPAddress local, HttpHost[] proxies, bool secure
                  , RouteInfo.TunnelType tunnelled, RouteInfo.LayerType layered) : this(target, local
                                                                                        , proxies != null ? Arrays.AsList(proxies) : null, secure, tunnelled, layered)
 {
 }