ClientConfigurationImpl implements ClientConfiguration { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ClientConfigurationImpl other = (ClientConfigurationImpl) obj; if (remoteAddress == null) { if (other.remoteAddress != null) return false; } else if (!remoteAddress.equals(other.remoteAddress)) return false; return true; } ClientConfigurationImpl(InetAddress addr);  ClientConfigurationImpl(InetAddress addr, int port);  ClientConfigurationImpl(InetSocketAddress remoteAddress); @Override InetSocketAddress getRemoteAddress(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() throws Exception { ClientConfigurationImpl c1 = new ClientConfigurationImpl(InetAddress.getByName("129.168.5.1"), 1000); ClientConfigurationImpl c2 = new ClientConfigurationImpl(InetAddress.getByName("129.168.5.1"), 1000); ClientConfigurationImpl c3 = new ClientConfigurationImpl(InetAddress.getByName("129.168.6.1"), 1000); ClientConfigurationImpl c4 = new ClientConfigurationImpl(InetAddress.getByName("129.168.5.1"), 2000); Assert.assertTrue(c1.equals(c2)); Assert.assertFalse(c1.equals(c3)); Assert.assertFalse(c1.equals(c4)); }