CharSequenceCodec implements ICharSequenceCodec { @Override public String decode(@Nonnull final byte[] message) throws DecodingException { try { return decoder.decode(ByteBuffer.wrap(message)).toString(); } catch (CharacterCodingException e) { throw new IllegalArgumentException("UTF-8 decoding has been failed because: " + e.getMessage(), e); } } private  CharSequenceCodec(final String name); static CharSequenceCodec create(final String name); @Override byte[] encode(@Nonnull final CharSequence message); @Override String decode(@Nonnull final byte[] message);  }
@Test public void decodeHexTest() throws DecodingException { String utf8DecodeResult = charSequenceCodec.decode(UTF_8_MSG); assertTrue(utf8DecodeResult.equals(SOURCE_MSG)); }