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

        Payload other = (Payload) o;
        return this.compressionInfo.equals(other.compressionInfo) && this.data.equals(other.data);
    }
@Test
    public void testEquals() {
        final String foo1 = "foo 1";
        final String foo2 = "foo 2";

        Payload a = Payload.from(foo1);
        Payload b = Payload.from(foo1);
        assertEquals(a, b);

        Payload c = Payload.from(foo2);
        assertNotEquals(a, c);

        Slime slime = new Slime();
        slime.setString(foo1);
        Payload d = Payload.from(new ConfigPayload(slime));
        assertNotEquals(a, d);

        slime.setString(foo1);
        Payload e = Payload.from(new ConfigPayload(slime));
        assertEquals(d, e);

        slime.setString("foo 2");
        Payload f = Payload.from(new ConfigPayload(slime));
        assertNotEquals(c, f);

        Payload g = Payload.from(new Utf8Array(foo1.getBytes(StandardCharsets.UTF_8)), CompressionInfo.uncompressed());
        Payload h = Payload.from(new Utf8Array(foo1.getBytes(StandardCharsets.UTF_8)), CompressionInfo.uncompressed());
        assertEquals(a, g);
        assertEquals(g, h);

        LZ4PayloadCompressor compressor = new LZ4PayloadCompressor();
        CompressionInfo info = CompressionInfo.create(CompressionType.LZ4, foo2.length());
        Utf8Array compressed = new Utf8Array(compressor.compress(foo2.getBytes()));

        Payload i = Payload.from(compressed, info);
        Payload j = Payload.from(compressed, info);
        assertEquals(i, j);
        assertNotEquals(c, j);
    }