aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-09 20:21:30 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-09 20:21:30 +1300
commit3c93192e8a2a392fe9ddf7bdcd512a7d6cceb3a9 (patch)
treeefe13db5bd9939b36ad104d4445e8d006efab7ca /test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
parenta7100fa9749a343a77c747a2cca8ae9e2faf91cb (diff)
downloadtrackermap-server-3c93192e8a2a392fe9ddf7bdcd512a7d6cceb3a9.tar.gz
trackermap-server-3c93192e8a2a392fe9ddf7bdcd512a7d6cceb3a9.tar.bz2
trackermap-server-3c93192e8a2a392fe9ddf7bdcd512a7d6cceb3a9.zip
Fix GT06 protocol
Diffstat (limited to 'test/org/traccar/protocol/Gt06ProtocolDecoderTest.java')
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index f20618061..ae4416435 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -6,17 +6,23 @@ import static org.junit.Assert.assertNull;
import org.junit.Test;
public class Gt06ProtocolDecoderTest {
-
+
@Test
public void testDecode() throws Exception {
-
+
Gt06ProtocolDecoder decoder = new Gt06ProtocolDecoder(new TestDataManager());
-
- byte[] buf1 = {0x78,0x78,0x1F,0x12,0x0B,0x08,0x1D,0x11,0x2E,0x10,(byte)0xCC,0x02,0x7A,(byte)0xC7,(byte)0xEB,0x0C,0x46,0x58,0x49,0x00,0x14,(byte)0x8F,0x01,(byte)0xCC,0x00,0x28,0x7D,0x00,0x1F,(byte)0xB8,0x00,0x03,(byte)0x80,(byte)0x81,0x0D,0x0A};
- assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1)));
-
- byte[] buf2 = {0x78,0x78,0x0D,0x01,0x08,0x64,0x71,0x70,0x03,0x28,0x35,(byte)0x81,0x00,0x09,0x3F,0x04,0x0D,0x0A};
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2)));
+
+ byte[] buf1 = {0x78,0x78,0x0d,0x01,0x03,0x53,0x41,(byte)0x90,0x36,0x06,0x60,0x61,0x00,0x03,(byte)0xc3,(byte)0xdf,0x0d,0x0a};
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1)));
+
+ byte[] buf2 = {0x78,0x78,0x1F,0x12,0x0B,0x08,0x1D,0x11,0x2E,0x10,(byte)0xCC,0x02,0x7A,(byte)0xC7,(byte)0xEB,0x0C,0x46,0x58,0x49,0x00,0x14,(byte)0x8F,0x01,(byte)0xCC,0x00,0x28,0x7D,0x00,0x1F,(byte)0xB8,0x00,0x03,(byte)0x80,(byte)0x81,0x0D,0x0A};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2)));
+
+ byte[] buf3 = {0x78,0x78,0x0D,0x01,0x08,0x64,0x71,0x70,0x03,0x28,0x35,(byte)0x81,0x00,0x09,0x3F,0x04,0x0D,0x0A};
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3)));
+
+ byte[] buf4 = {0x78,0x78,0x0D,0x01,0x01,0x23,0x45,0x67,(byte)0x89,0x01,0x23,0x45,0x00,0x01,(byte)0x8C,(byte)0xDD,0x0D,0x0A};
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf4)));
}