aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-29 15:25:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-29 15:25:14 +1200
commitc534819d12b984e845f41a95efa3f0ef7b6ebbe6 (patch)
tree4a356ea66b7a5256c4ce701d35af11841b1f3dd0
parent7dbd1a5ac3940de89c84410859aa1bebeabda5d1 (diff)
downloadtrackermap-server-c534819d12b984e845f41a95efa3f0ef7b6ebbe6.tar.gz
trackermap-server-c534819d12b984e845f41a95efa3f0ef7b6ebbe6.tar.bz2
trackermap-server-c534819d12b984e845f41a95efa3f0ef7b6ebbe6.zip
Fix Cityeasy frame decoder
-rw-r--r--src/org/traccar/protocol/CityeasyProtocol.java2
-rw-r--r--test/org/traccar/protocol/CityeasyProtocolDecoderTest.java6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/CityeasyProtocol.java b/src/org/traccar/protocol/CityeasyProtocol.java
index 849b96a0c..69f7ad5ac 100644
--- a/src/org/traccar/protocol/CityeasyProtocol.java
+++ b/src/org/traccar/protocol/CityeasyProtocol.java
@@ -34,7 +34,7 @@ public class CityeasyProtocol extends BaseProtocol {
serverList.add(new TrackerServer(new ServerBootstrap(), this.getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
- pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -2, 0));
+ pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0));
pipeline.addLast("objectDecoder", new CityeasyProtocolDecoder(CityeasyProtocol.this));
}
});
diff --git a/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java b/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java
index cdb34b817..487d20d4e 100644
--- a/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java
@@ -17,12 +17,18 @@ public class CityeasyProtocolDecoderTest extends ProtocolDecoderTest {
assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"545400153520000000000100010000000111000D0A"))));
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "54540019357557024902000002520704300000000376390d0a"))));
+
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"5454006135200000000001000332303134313131303039353430392C412C342C4E2C32322E3533373232382C452C3131342E3032323737342C302E312C312E392C35302E363B3436302C302C31303137332C343635322C34310000000B63130D0A"))));
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"5454006135200000000001000432303134313131303039353330362C412C352C4E2C32322E3533373233352C452C3131342E3032323838312C302E322C312E362C35342E313B3436302C302C31303137332C343635322C343100000045EC620D0A"))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "5454009035755702490200000332303135303732393033303834352c412c362c4e2c31322e3833353735362c452c37372e3638373039362c302e332c312e322c3931302e303b3430342c34352c31303638312c31313632312c34332c31303638312c31313632332c32312c31303638312c32323538332c32302c31303638312c32333338312c31380000000267370d0a"))));
+
}
}