UuidCodec implements MessageCodec<UUID, UUID> { @Override public UUID decodeFromWire(int pos, Buffer buffer) { byte[] bytes = buffer.getBytes(pos, buffer.length()); return UUID.fromString(new String(bytes, StandardCharsets.UTF_8)); }  @Override void encodeToWire(Buffer buffer, UUID s); @Override UUID decodeFromWire(int pos, Buffer buffer); @Override UUID transform(UUID s); @Override String name(); @Override byte systemCodecID();  }
@Test public void testDncodeFromWire() { UuidCodec codec = new UuidCodec(); UUID uuid = UUID.randomUUID(); Buffer buffer = Buffer.buffer(uuid.toString()); UUID decoded = codec.decodeFromWire(0, buffer); assertThat(decoded).isEqualTo(uuid); }