Host implements NamedEndpoint, Serializable { @Override public int hashCode() { int hash = LangUtils.HASH_SEED; hash = LangUtils.hashCode(hash, this.lcName); hash = LangUtils.hashCode(hash, this.port); return hash; } Host(final String name, final int port); static Host create(final String s); @Override String getHostName(); @Override int getPort(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testHashCode() throws Exception { final Host host1 = new Host("somehost", 8080); final Host host2 = new Host("somehost", 80); final Host host3 = new Host("someotherhost", 8080); final Host host4 = new Host("somehost", 80); Assert.assertTrue(host1.hashCode() == host1.hashCode()); Assert.assertTrue(host1.hashCode() != host2.hashCode()); Assert.assertTrue(host1.hashCode() != host3.hashCode()); Assert.assertTrue(host2.hashCode() == host4.hashCode()); }