@Test
  public void testEqualsWithHashCode() {
    // Test the Reflexive Property
    assertTrue(connectionId1.equals(connectionId1));

    // Test the Symmetry Property
    ConnectionId connectionId = new ConnectionId(testUser1, serviceName, address);
    assertTrue(connectionId.equals(connectionId1) && connectionId1.equals(connectionId));
    assertEquals(connectionId.hashCode(), connectionId1.hashCode());

    // Test the Transitive Property
    ConnectionId connectionId3 = new ConnectionId(testUser1, serviceName, address);
    assertTrue(connectionId1.equals(connectionId) && connectionId.equals(connectionId3)
      && connectionId1.equals(connectionId3));
    assertEquals(connectionId.hashCode(), connectionId3.hashCode());

    // Test For null
    assertFalse(connectionId1.equals(null));

    // Test different instances of same class
    assertFalse(connectionId1.equals(connectionId2));
  }
Test if the over-ridden equals method satisfies all the properties (reflexive, symmetry,
transitive and null) along with their hashcode
hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestConnectionId.java