1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.net;
20
21 import java.io.Serializable;
22
23
24
25
26
27
28 public class IPSocket implements Serializable {
29
30
31 private static final long serialVersionUID = 2978329372952402188L;
32
33 private final String address;
34 private final int port;
35
36 public IPSocket(String address, int port) {
37 this.address = address;
38 this.port = port;
39 }
40
41 public String getAddress() {
42 return address;
43 }
44
45 public int getPort() {
46 return port;
47 }
48
49 @Override
50 public int hashCode() {
51 final int prime = 31;
52 int result = 1;
53 result = prime * result + ((address == null) ? 0 : address.hashCode());
54 result = prime * result + port;
55 return result;
56 }
57
58 @Override
59 public boolean equals(Object obj) {
60 if (this == obj)
61 return true;
62 if (obj == null)
63 return false;
64 if (getClass() != obj.getClass())
65 return false;
66 IPSocket other = (IPSocket) obj;
67 if (address == null) {
68 if (other.address != null)
69 return false;
70 } else if (!address.equals(other.address))
71 return false;
72 if (port != other.port)
73 return false;
74 return true;
75 }
76
77 @Override
78 public String toString() {
79 return "[address=" + address + ", port=" + port + "]";
80 }
81
82 }