Skip to content

Commit

Permalink
Fix: duplicate of HeaderOptions with request tag
Browse files Browse the repository at this point in the history
  • Loading branch information
szysas committed Oct 2, 2023
1 parent fa5f36c commit a247c83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public HeaderOptions duplicate() {
opts.block2Res = block2Res;
opts.size2Res = size2Res;
opts.echo = echo;
opts.requestTag = requestTag;

return opts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ public void testMultipleHeaders() throws IOException, CoapException {
hdr.setUriHost("uri-host");
hdr.setUriPort(5683);
hdr.setUriQuery("par1=dupa&par2=dupa2");
hdr.setEcho(decodeHex("0102030405060708090a"));
hdr.setRequestTag(Opaque.of("tag-0001"));
hdr.put(36, Opaque.variableUInt((1357)));

ByteArrayOutputStream baos = new ByteArrayOutputStream();
Expand All @@ -105,6 +103,8 @@ public void testMultipleHeaders() throws IOException, CoapException {
System.out.println(hdr2);
assertTrue(hdr.equals(hdr2));

// duplicate
assertEquals(hdr, hdr.duplicate());
}

@Test
Expand Down Expand Up @@ -171,13 +171,17 @@ public void testMultipleExHeaders() throws IOException, CoapException {
hdr.setBlock1Req(new BlockOption(2, BlockSize.S_16, true));
hdr.setBlock2Res(new BlockOption(4, BlockSize.S_1024, false));
hdr.setObserve(4321);
hdr.setEcho(decodeHex("0102030405060708090a"));
hdr.setRequestTag(Opaque.of("tag-0001"));

HeaderOptions hdr2 = deserialize(serialize(hdr));

System.out.println(hdr);
System.out.println(hdr2);
assertTrue(hdr.equals(hdr2));
assertEquals(hdr, hdr2);

// duplicate
assertEquals(hdr, hdr.duplicate());
}

@Test
Expand Down

0 comments on commit a247c83

Please sign in to comment.