AppHandleConnectionSpec implements ConnectionSpec { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AppHandleConnectionSpec that = (AppHandleConnectionSpec) o; if (!clientAddress.equals(that.clientAddress)) return false; if (!clientHostName.equals(that.clientHostName)) return false; if (division != null ? !division.equals(that.division) : that.division != null) return false; if (!handle.equals(that.handle)) return false; return true; } AppHandleConnectionSpec(final String handle, String clientAddress, String clientHostName);  AppHandleConnectionSpec(final String handle, final String division, String clientAddress, String clientHostName); String getDivision(); String getHandle(); String getClientAddress(); String getClientHostName(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { AppHandleConnectionSpec av1 = new AppHandleConnectionSpec("1AB2C3D4E5F6", "960", "123.45.67.89", "www.example.org"); AppHandleConnectionSpec av2 = new AppHandleConnectionSpec("1AB2C3D4E5F6", "960", "123.45.67.89", "www.example.org"); AppHandleConnectionSpec av3 = new AppHandleConnectionSpec("6F5E4D3C2B1A", "960", "123.45.67.89", "www.example.org"); AppHandleConnectionSpec av4 = new AppHandleConnectionSpec("1AB2C3D4E5F6", "123.45.67.89", "www.example.org"); assertThat(av1, equalTo(av2)); assertThat(av2, equalTo(av1)); assertThat(av3, not(equalTo(av1))); assertThat(av1, not(equalTo(av3))); assertThat(av4, not(equalTo(av1))); assertThat(av1, not(equalTo(av4))); }