aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
blob: a9f53c4c46185abd87f2f71b5b01196144c3f0d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.traccar.protocol;

import org.jboss.netty.buffer.ChannelBuffers;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;

public class AplicomProtocolDecoderTest {

    @Test
    public void testDecode() throws Exception {

        AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(null);
        decoder.setDataManager(new TestDataManager());

        int[] buf1 = {0x44,0xC2,0x01,0x43,0x72,0x07,0x29,0xD6,0x84,0x00,0x43,0x03,0x1f,0xff,0x71,0x91,0xC0,0x45,0x0e,0xf9,0x06,0x45,0x0e,0xf9,0x06,0x03,0xb2,0x0b,0x80,0x03,0xb2,0x0b,0x80,0x06,0x64,0x65,0xb3,0x87,0x0c,0xe3,0x0f,0x01,0x0c,0xe3,0x0c,0xe3,0x00,0x32,0x00,0x00,0x15,0x20,0x00,0x00,0x00,0x03,0x0a,0xa2,0x00,0x00,0x3b,0x13,0x00,0x00,0x00,0x32,0x03,0x00,0x00,0x0b,0xcb,0x17,0xac,0xff,0x00,0x99,0x00,0x01,0x86,0xa0,0x02};
        assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))));

        int[] buf2 = {0x44,0x01,0x29,0xD6,0x84,0x00,0x2b,0x07,0x00,0xC0,0x45,0x0e,0xf9,0x06,0x45,0x0e,0xf9,0x06,0x03,0xb2,0x0b,0x80,0x03,0xb2,0x0b,0x80,0x06,0x64,0x65,0xb3,0x87,0x0c,0xe3,0x0f,0x01,0x0c,0xe3,0x0c,0xe3,0x00,0x00,0x3b,0x13,0x03,0x00,0x00,0x0b,0xcb,0x17,0xa};
        assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2))));

    }

}