Example usage for io.netty.buffer ByteBufUtil equals

List of usage examples for io.netty.buffer ByteBufUtil equals

Introduction

In this page you can find the example usage for io.netty.buffer ByteBufUtil equals.

Prototype

public static boolean equals(ByteBuf bufferA, ByteBuf bufferB) 

Source Link

Document

Returns true if and only if the two specified buffers are identical to each other as described in ByteBuf#equals(Object) .

Usage

From source file:com.mobius.software.mqtt.parser.test.TestPuback.java

License:Open Source License

@Test
public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Puback actual = (Puback) MQParser.decode(MQParser.encode(expected));
    actual.setPacketID(1000); // mismatch
    assertFalse("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPubcomp.java

License:Open Source License

@Test
public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Pubcomp actual = (Pubcomp) MQParser.decode(MQParser.encode(expected));
    assertTrue("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPubcomp.java

License:Open Source License

@Test
public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Pubcomp actual = (Pubcomp) MQParser.decode(MQParser.encode(expected));
    actual.setPacketID(1000); // mismatch
    assertFalse("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPublish.java

License:Open Source License

@Test
public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    ByteBuf buf = MQParser.encode(expected);
    MQMessage actual = MQParser.decode(Unpooled.copiedBuffer(buf));
    assertTrue("Invalid binary content", ByteBufUtil.equals(buf, MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPublish.java

License:Open Source License

@Test
public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Publish actual = new Publish(expected.getPacketID(),
            new Topic(new Text("other_topic"), expected.getTopic().getQos()), expected.getContent(),
            expected.isRetain(), expected.isDup());
    assertFalse("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPubrec.java

License:Open Source License

@Test
public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Pubrec actual = (Pubrec) MQParser.decode(MQParser.encode(expected));
    assertTrue("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPubrec.java

License:Open Source License

@Test
public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Pubrec actual = (Pubrec) MQParser.decode(MQParser.encode(expected));
    actual.setPacketID(1000); // mismatch
    assertFalse("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPubrel.java

License:Open Source License

@Test
public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Pubrel actual = (Pubrel) MQParser.decode(MQParser.encode(expected));
    assertTrue("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestPubrel.java

License:Open Source License

@Test
public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Pubrel actual = (Pubrel) MQParser.decode(MQParser.encode(expected));
    actual.setPacketID(1000); // mismatch
    assertFalse("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}

From source file:com.mobius.software.mqtt.parser.test.TestSuback.java

License:Open Source License

@Test
public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException {
    Suback actual = (Suback) MQParser.decode(MQParser.encode(expected));
    assertTrue("Invalid binary content",
            ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual)));
}