@Test public void testImmutable() throws CloneNotSupportedException { HttpHost[] proxies = new HttpHost[]{ PROXY1, PROXY2, PROXY3 }; HttpRoute route1 = new HttpRoute(TARGET1, null, proxies, false, TunnelType.PLAIN, LayerType.PLAIN); HttpRoute route2 = (HttpRoute) route1.clone(); HttpRoute route3 = new HttpRoute(TARGET1, null, proxies.clone(), false, TunnelType.PLAIN, LayerType.PLAIN); proxies[1] = PROXY3; proxies[2] = PROXY2; Assert.assertEquals("route differs from clone", route2, route1); Assert.assertEquals("route was modified", route3, route1); }
@Override public Object clone() throws CloneNotSupportedException { return super.clone(); }
HttpRoute implements RouteInfo, Cloneable { @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } }
HttpRoute implements RouteInfo, Cloneable { @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } private  HttpRoute(InetAddress local,
                      HttpHost target, HttpHost[] proxies,
                      boolean secure,
                      TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, HttpHost[] proxies,
                     boolean secure, TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, HttpHost proxy,
                     boolean secure, TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, boolean secure);  HttpRoute(HttpHost target);  HttpRoute(HttpHost target, InetAddress local, HttpHost proxy,
                     boolean secure); }
HttpRoute implements RouteInfo, Cloneable { @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } private  HttpRoute(InetAddress local,
                      HttpHost target, HttpHost[] proxies,
                      boolean secure,
                      TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, HttpHost[] proxies,
                     boolean secure, TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, HttpHost proxy,
                     boolean secure, TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, boolean secure);  HttpRoute(HttpHost target);  HttpRoute(HttpHost target, InetAddress local, HttpHost proxy,
                     boolean secure); final HttpHost getTargetHost(); final InetAddress getLocalAddress(); final int getHopCount(); final HttpHost getHopTarget(int hop); final HttpHost getProxyHost(); final TunnelType getTunnelType(); final boolean isTunnelled(); final LayerType getLayerType(); final boolean isLayered(); final boolean isSecure(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Override final String toString(); @Override Object clone(); }
HttpRoute implements RouteInfo, Cloneable { @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } private  HttpRoute(InetAddress local,
                      HttpHost target, HttpHost[] proxies,
                      boolean secure,
                      TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, HttpHost[] proxies,
                     boolean secure, TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, HttpHost proxy,
                     boolean secure, TunnelType tunnelled, LayerType layered);  HttpRoute(HttpHost target, InetAddress local, boolean secure);  HttpRoute(HttpHost target);  HttpRoute(HttpHost target, InetAddress local, HttpHost proxy,
                     boolean secure); final HttpHost getTargetHost(); final InetAddress getLocalAddress(); final int getHopCount(); final HttpHost getHopTarget(int hop); final HttpHost getProxyHost(); final TunnelType getTunnelType(); final boolean isTunnelled(); final LayerType getLayerType(); final boolean isLayered(); final boolean isSecure(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Override final String toString(); @Override Object clone();  }