### Question:
StompCodec { public StompFrame decode(ByteBuffer data) throws IOException { lastReadTime = System.currentTimeMillis(); if (currentParser == null) { currentParser = commandParser; } return currentParser.parse(data); }  StompFrame decode(ByteBuffer data); ByteBuffer encode(StompFrame frame); void write(DataOutput out, StompFrame frame); static Buffer encodeHeader(String value); String getVersion(); void setVersion(String version); long getLastReadTime(); int getMaxCommandLength(); int getMaxHeaderLength(); void setMaxHeaderLength(int maxHeaderLength); int getMaxHeaders(); void setMaxHeaders(int maxHeaders); int getMaxContentSize(); void setMaxContentSize(int maxContentSize);  }### Answer:
@Test public void testSimpleCommandDecode() throws IOException { String input = "CONNECTED\n" + "version:1.1\n" + "server:activemq/5.9\n\n" + StompConstants.NULL; ByteBuffer buffer = ByteBuffer.wrap(input.getBytes(StompConstants.UTF8)); StompFrame frame = codec.decode(buffer); assertNotNull(frame); assertEquals(CONNECTED, frame.getCommand()); assertEquals(V1_1, frame.getProperty("version")); assertEquals("activemq/5.9", frame.getProperty("server")); }
@Test public void testDecodeTextMessage() throws IOException { final String body = "This is a test"; String input = "MESSAGE\n" + "version:1.1\n" + "server:activemq/5.9\n\n" + body + StompConstants.NULL; ByteBuffer buffer = ByteBuffer.wrap(input.getBytes(StompConstants.UTF8)); StompFrame frame = codec.decode(buffer); assertNotNull(frame); assertEquals(MESSAGE, frame.getCommand()); assertEquals(V1_1, frame.getProperty("version")); assertEquals("activemq/5.9", frame.getProperty("server")); assertEquals(body, frame.getContentAsString()); }