### Question:
StompCodec { public ByteBuffer encode(StompFrame frame) throws IOException { DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(); try { write(dataOut, frame); } finally { dataOut.close(); } return dataOut.toBuffer().toByteBuffer(); }  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 testSimpleCommandEncode() throws IOException { StompFrame frame = new StompFrame("CONNECTED"); frame.setProperty("version", V1_1); frame.setProperty("server", "activemq/5.9"); ByteBuffer encoded = codec.encode(frame); assertNotNull(encoded); assertTrue(encoded.position() == 0); assertTrue(encoded.limit() > 0); }