@Test public void testRequestParsing() { Request request = new Request(Code.POST); request.setDestinationContext(ENDPOINT_CONTEXT); request.setType(Type.NON); request.setMID(expectedMid); request.setToken(new byte[] { 11, 82, -91, 77, 3 }); request.getOptions().addIfMatch(new byte[] { 34, -17 }).addIfMatch(new byte[] { 88, 12, -2, -99, 5 }) .setContentFormat(40).setAccept(40); RawData rawData = serializer.serializeRequest(request); Request result = (Request) parser.parseMessage(rawData); assertEquals(request.getMID(), result.getMID()); assertEquals(request.getToken(), result.getToken()); assertEquals(request.getOptions().asSortedList(), result.getOptions().asSortedList()); }
public final Message parseMessage(final RawData raw) { if (raw == null) { throw new NullPointerException("raw-data must not be null!"); } Message message = parseMessage(raw.getBytes()); message.setSourceContext(raw.getEndpointContext()); message.setNanoTimestamp(raw.getReceiveNanoTimestamp()); return message; }
DataParser { public final Message parseMessage(final RawData raw) { if (raw == null) { throw new NullPointerException("raw-data must not be null!"); } Message message = parseMessage(raw.getBytes()); message.setSourceContext(raw.getEndpointContext()); message.setNanoTimestamp(raw.getReceiveNanoTimestamp()); return message; } }
DataParser { public final Message parseMessage(final RawData raw) { if (raw == null) { throw new NullPointerException("raw-data must not be null!"); } Message message = parseMessage(raw.getBytes()); message.setSourceContext(raw.getEndpointContext()); message.setNanoTimestamp(raw.getReceiveNanoTimestamp()); return message; }  }
DataParser { public final Message parseMessage(final RawData raw) { if (raw == null) { throw new NullPointerException("raw-data must not be null!"); } Message message = parseMessage(raw.getBytes()); message.setSourceContext(raw.getEndpointContext()); message.setNanoTimestamp(raw.getReceiveNanoTimestamp()); return message; }  final Message parseMessage(final RawData raw); final Message parseMessage(final byte[] msg); static void parseOptionsAndPayload(DatagramReader reader, Message message); }
DataParser { public final Message parseMessage(final RawData raw) { if (raw == null) { throw new NullPointerException("raw-data must not be null!"); } Message message = parseMessage(raw.getBytes()); message.setSourceContext(raw.getEndpointContext()); message.setNanoTimestamp(raw.getReceiveNanoTimestamp()); return message; }  final Message parseMessage(final RawData raw); final Message parseMessage(final byte[] msg); static void parseOptionsAndPayload(DatagramReader reader, Message message);  }