@Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ProviderInfo that = (ProviderInfo) o;

        if (port != that.port) {
            return false;
        }
        if (rpcVersion != that.rpcVersion) {
            return false;
        }
        if (protocolType != null ? !protocolType.equals(that.protocolType) : that.protocolType != null) {
            return false;
        }
        if (host != null ? !host.equals(that.host) : that.host != null) {
            return false;
        }
        if (path != null ? !path.equals(that.path) : that.path != null) {
            return false;
        }
        if (serializationType != null ? !serializationType.equals(that.serializationType)
            : that.serializationType != null) {
            return false;
        }
        // return staticAttrs != null ? staticAttrs.equals(that.staticAttrs) : that.staticAttrs == null;
        return true;
    }
@Test
    public void testEquals() throws Exception {

        ProviderInfo p1 = new ProviderInfo();
        ProviderInfo p2 = new ProviderInfo();

        Assert.assertEquals(p1, p2);

        List<ProviderInfo> ps = new ArrayList<ProviderInfo>();
        ps.add(p1);
        ps.remove(p2);
        Assert.assertEquals(ps.size(), 0);

        p1.setHost("127.0.0.1");
        Assert.assertFalse(p1.equals(p2));
        p2.setHost("127.0.0.2");
        Assert.assertFalse(p1.equals(p2));
        p2.setHost("127.0.0.1");
        Assert.assertTrue(p1.equals(p2));

        p1.setPort(12200);
        Assert.assertFalse(p1.equals(p2));
        p2.setPort(12201);
        Assert.assertFalse(p1.equals(p2));
        p2.setPort(12200);
        Assert.assertTrue(p1.equals(p2));

        p1.setRpcVersion(4420);
        Assert.assertFalse(p1.equals(p2));
        p2.setRpcVersion(4421);
        Assert.assertFalse(p1.equals(p2));
        p2.setRpcVersion(4420);
        Assert.assertTrue(p1.equals(p2));

        p1.setProtocolType("p1");
        Assert.assertFalse(p1.equals(p2));
        p2.setProtocolType("p2");
        Assert.assertFalse(p1.equals(p2));
        p2.setProtocolType("p1");
        Assert.assertTrue(p1.equals(p2));

        p1.setSerializationType("zzz");
        Assert.assertFalse(p1.equals(p2));
        p2.setSerializationType("yyy");
        Assert.assertFalse(p1.equals(p2));
        p2.setSerializationType("zzz");
        Assert.assertTrue(p1.equals(p2));

        //        p1.setInterfaceId("com.xxx");
        //        Assert.assertFalse(p1.equals(p2));
        //        p2.setInterfaceId("com.yyy");
        //        Assert.assertFalse(p1.equals(p2));
        //        p2.setInterfaceId("com.xxx");
        //        Assert.assertTrue(p1.equals(p2));
        //
        //        p1.setUniqueId("u1");
        //        Assert.assertFalse(p1.equals(p2));
        //        p2.setUniqueId("u2");
        //        Assert.assertFalse(p1.equals(p2));
        //        p2.setUniqueId("u1");
        //        Assert.assertTrue(p1.equals(p2));

        p1.setPath("/aaa");
        Assert.assertFalse(p1.equals(p2));
        p2.setPath("/bbb");
        Assert.assertFalse(p1.equals(p2));
        p2.setPath("/aaa");
        Assert.assertTrue(p1.equals(p2));

        p1.setWeight(200);
        Assert.assertTrue(p1.equals(p2));
        p2.setWeight(300);
        Assert.assertTrue(p1.equals(p2));
        p2.setWeight(200);
        Assert.assertTrue(p1.equals(p2));

        p1.setDynamicAttr("x1", "y1");
        Assert.assertTrue(p1.equals(p2));
        p2.setDynamicAttr("x1", "y1");
        Assert.assertTrue(p1.equals(p2));
        p2.setDynamicAttr("x2", "y2");
        Assert.assertTrue(p1.equals(p2));

        p1.setStaticAttr("x1", "y1");
        Assert.assertTrue(p1.equals(p2));
        p2.setStaticAttr("x1", "y1");
        Assert.assertTrue(p1.equals(p2));
        p1.setStaticAttr("x2", "y2");
        Assert.assertTrue(p1.equals(p2));
        p2.setStaticAttr("x2", "y2");
        Assert.assertTrue(p1.equals(p2));

        ps.add(p1);
        ps.remove(p2);
        Assert.assertEquals(ps.size(), 0);
    }