List of usage examples for io.netty.buffer ByteBufUtil equals
public static boolean equals(ByteBuf bufferA, ByteBuf bufferB)
From source file:com.addthis.basis.chars.ByteArrayReadOnlyUtfBuf.java
License:Apache License
@Override public boolean equals(Object obj) { if (obj == this) { return true; }/* ww w . j a v a 2 s . c o m*/ if (obj instanceof ByteArrayReadOnlyUtfBuf) { return Arrays.equals(data, ((ByteArrayReadOnlyUtfBuf) obj).data); } else if (obj instanceof ReadableCharBuf) { return ByteBufUtil.equals(((ReadableCharBuf) obj).toByteBuf(), toByteBuf()); } return false; }
From source file:com.addthis.basis.chars.ReadOnlyUtfBuf.java
License:Apache License
@Override public boolean equals(Object obj) { if (obj == this) { return true; }//from ww w . j ava 2 s . c om if (obj instanceof ReadableCharBuf) { return ByteBufUtil.equals(((ReadableCharBuf) obj).toByteBuf(), content()); } return false; }
From source file:com.mobius.software.mqtt.parser.test.TestConnack.java
License:Open Source License
@Test public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException { Connack actual = (Connack) 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.TestConnack.java
License:Open Source License
@Test public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException { Connack actual = (Connack) MQParser.decode(MQParser.encode(expected)); actual.setSessionPresent(false); // mismatch assertFalse("Invalid binary content", ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual))); }
From source file:com.mobius.software.mqtt.parser.test.TestConnect.java
License:Open Source License
@Test public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException { Connect actual = (Connect) MQParser.decode(MQParser.encode(expected)); assertTrue("Encoding error: ", ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual))); }
From source file:com.mobius.software.mqtt.parser.test.TestConnect.java
License:Open Source License
@Test public void testNegativeByteContent() throws UnsupportedEncodingException, MalformedMessageException { Connect actual = (Connect) MQParser.decode(MQParser.encode(expected)); actual.setClientID("_987654321"); assertFalse("Expected unequal: ", ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual))); }
From source file:com.mobius.software.mqtt.parser.test.TestDisconnect.java
License:Open Source License
@Test public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException { Disconnect actual = (Disconnect) 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.TestPingreq.java
License:Open Source License
@Test public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException { Pingreq actual = (Pingreq) 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.TestPingresp.java
License:Open Source License
@Test public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException { Pingresp actual = (Pingresp) 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.TestPuback.java
License:Open Source License
@Test public void testPositiveByteContent() throws UnsupportedEncodingException, MalformedMessageException { Puback actual = (Puback) MQParser.decode(MQParser.encode(expected)); assertTrue("Invalid binary content", ByteBufUtil.equals(MQParser.encode(expected), MQParser.encode(actual))); }