aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/ProtocolTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/traccar/ProtocolTest.java')
-rw-r--r--test/org/traccar/ProtocolTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 1b5c0ea00..377474556 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -52,6 +52,14 @@ public class ProtocolTest extends BaseTest {
return builder.toString();
}
+ protected ByteBuf concatenateBuffers(ByteBuf... buffers) {
+ ByteBuf result = Unpooled.buffer();
+ for (ByteBuf buf : buffers) {
+ result.writeBytes(buf);
+ }
+ return result;
+ }
+
protected ByteBuf binary(String... data) {
return Unpooled.wrappedBuffer(DataConverter.parseHex(concatenateStrings(data)));
}
@@ -60,6 +68,10 @@ public class ProtocolTest extends BaseTest {
return concatenateStrings(data);
}
+ protected String text(ByteBuf data) {
+ return data.toString(StandardCharsets.ISO_8859_1);
+ }
+
protected ByteBuf buffer(String... data) {
return Unpooled.copiedBuffer(concatenateStrings(data), StandardCharsets.ISO_8859_1);
}