Hex implements ICodec { @Override public byte[] encode(@Nonnull final byte[] message) throws EncodingException { try { return hexCodec.encode(message); } catch (Exception e) { throw new EncodingException("Hex encoding has been failed because: " + e.getMessage(), e); } } private  Hex(); static Hex create(); @Override byte[] encode(@Nonnull final byte[] message); @Override byte[] decode(@Nonnull final byte[] message);  }
@Test public void encodeHexTest() throws EncodingException { byte[] hexEncodeResult = hex.encode(SOURCE_MSG); assertTrue(Arrays.equals(hexEncodeResult, HEX_MSG)); }