package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffers; import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; import static org.traccar.helper.DecoderVerifier.verify; import org.traccar.helper.TestDataManager; public class Gt02ProtocolDecoderTest { @Test public void testDecode() throws Exception { Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(new TestDataManager(), null, null); verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( new int[] {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,0x89,0x01,0x23,0x45,0x00,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x6B,0x3F,0x3E,0x02,0x6B,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0D,0x0A})))); assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( new int[] {0x68,0x68,0x11,0x06,0x03,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x00,0x1a,0x04,0x02,0x29,0x2d,0x0d,0x0a})))); verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( new int[] {0x68,0x68,0x25,0x00,0xa4,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x01,0x10,0x0e,0x09,0x06,0x0a,0x1d,0x1b,0x00,0xad,0xe1,0xc9,0x0b,0x79,0xea,0x30,0x00,0x01,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0d,0x0a})))); } }