aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-08-03 22:48:01 +0800
committerAnton Tananaev <anton.tananaev@gmail.com>2016-08-03 22:48:01 +0800
commitc2851143d996e8ae1741adb1b6f20cc7e447f327 (patch)
treef9d8efc338cb0c707d23ad51b1a2a2e5424bc6cd
parent00f496895e056ecec5c804565df07d62fafc62a2 (diff)
downloadtraccar-server-c2851143d996e8ae1741adb1b6f20cc7e447f327.tar.gz
traccar-server-c2851143d996e8ae1741adb1b6f20cc7e447f327.tar.bz2
traccar-server-c2851143d996e8ae1741adb1b6f20cc7e447f327.zip
Fix Tzone frame decoder (fix #2183)
-rw-r--r--src/org/traccar/protocol/TzoneProtocol.java2
-rw-r--r--test/org/traccar/protocol/TzoneProtocolDecoderTest.java6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/TzoneProtocol.java b/src/org/traccar/protocol/TzoneProtocol.java
index 2d98e3f79..fcf673a57 100644
--- a/src/org/traccar/protocol/TzoneProtocol.java
+++ b/src/org/traccar/protocol/TzoneProtocol.java
@@ -34,7 +34,7 @@ public class TzoneProtocol extends BaseProtocol {
serverList.add(new TrackerServer(new ServerBootstrap(), this.getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
- pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(256, 2, 2));
+ pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(256, 2, 2, 2, 0));
pipeline.addLast("objectDecoder", new TzoneProtocolDecoder(TzoneProtocol.this));
}
});
diff --git a/test/org/traccar/protocol/TzoneProtocolDecoderTest.java b/test/org/traccar/protocol/TzoneProtocolDecoderTest.java
index 8d60bdfe4..2ae776f36 100644
--- a/test/org/traccar/protocol/TzoneProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TzoneProtocolDecoderTest.java
@@ -12,6 +12,12 @@ public class TzoneProtocolDecoderTest extends ProtocolTest {
TzoneProtocolDecoder decoder = new TzoneProtocolDecoder(new TzoneProtocol());
verifyPosition(decoder, binary(
+ "545a00582424010b022000000860041028904798100803030c2700160a007da96203356669100803030c2700000000000e000004002813730010aa4000000617017100000000000080000000000000000000000000000000007701fe0d0a"));
+
+ verifyPosition(decoder, binary(
+ "545a00582424010b022000000860041028904798100803030d1a001609007da9620335666a100803030d1900000000000e000004002813730010aa400000063701720000000000008000000000000000000000000000000000787f0c0d0a"));
+
+ verifyPosition(decoder, binary(
"545a00582424010b021e000008637710239476270f080b0a3228001600000000000000000000000000000000000000000000000401a00822001088c00020183701a6053800000000800000000000000000000000000000000077c9860d0a"),
position("1999-11-30 00:00:00.000", false, 0.0, 0.0));