1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 package org/apache/commons/httpclient/package-summary.html">> org.apache.commons.httpclient;
32
33 import org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory;
34 import org.apache.commons.httpclient.protocol.Protocol;
35 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
36 import org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory;
37
38 import junit.framework.Test;
39 import junit.framework.TestCase;
40 import junit.framework.TestSuite;
41
42 /***
43 */
44 public class TestEquals extends TestCase {
45
46 public static Test suite() {
47 return new TestSuite(TestEquals.class);
48 }
49
50 /***
51 *
52 */
53 public TestEquals() {
54 super();
55 }
56
57 /***
58 * @param arg0
59 */
60 public TestEquals(String arg0) {
61 super(arg0);
62 }
63
64 public void testProtocol() {
65
66 Protocol p1 = new Protocol("test", new DefaultProtocolSocketFactory(), 123);
67 Protocol p2 = new Protocol("test", new DefaultProtocolSocketFactory(), 123);
68
69 assertTrue(p1.equals(p2));
70 assertTrue(p2.equals(p1));
71 }
72
73 public void testProtocolSocketFactory() {
74
75 ProtocolSocketFactory p1 = new DefaultProtocolSocketFactory();
76 ProtocolSocketFactory p2 = new DefaultProtocolSocketFactory();
77
78 assertTrue(p1.equals(p2));
79 assertTrue(p2.equals(p1));
80
81 p1 = new SSLProtocolSocketFactory();
82 p2 = new SSLProtocolSocketFactory();
83
84 assertTrue(p1.equals(p2));
85 assertTrue(p2.equals(p1));
86
87 }
88
89 public void testHostConfiguration() {
90
91 HostConfiguration hc1 = new HostConfiguration();
92 hc1.setHost("http", 80, "http");
93
94 HostConfiguration hc2 = new HostConfiguration();
95 hc2.setHost("http", 80, "http");
96
97 assertTrue(hc1.equals(hc2));
98 assertTrue(hc2.equals(hc1));
99 }
100
101 }