### Question:
LumberjackEncoder { public byte[] encode(final LumberjackFrame frame) { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); buffer.write(frame.getVersion()); buffer.write(frame.getFrameType()); try { buffer.write(frame.getPayload()); } catch (IOException e) { throw new LumberjackFrameException("Error decoding Lumberjack frame: " + e.getMessage(), e); } return buffer.toByteArray(); }  byte[] encode(final LumberjackFrame frame);  }### Answer:
@Test public void testEncode() { LumberjackFrame frame = new LumberjackFrame.Builder() .version((byte) 0x31) .frameType((byte) 0x41) .payload(ByteBuffer.allocate(8).putLong(123).array()) .build(); byte[] encoded = encoder.encode(frame); Assert.assertArrayEquals(DatatypeConverter.parseHexBinary("3141000000000000007B"), encoded); }