### Question:
Endpoint implements Copiable<Endpoint>, Serializable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (this.ip == null ? 0 : this.ip.hashCode()); result = prime * result + this.port; return result; } Endpoint();  Endpoint(String address, int port); String getIp(); int getPort(); @Override String toString(); @Override Endpoint copy(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testEqualsHashCode() { final Endpoint ep1 = new Endpoint("192.168.1.1", 8080); final Endpoint ep2 = new Endpoint("192.168.1.1", 8080); assertEquals(ep1, ep2); assertEquals(ep1.hashCode(), ep2.hashCode()); }