Hex implements ICodec { @Override public byte[] decode(@Nonnull final byte[] message) throws DecodingException { try { return hexCodec.decode(message); } catch (Exception e) { throw new DecodingException("Hex decoding 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 decodeHexTest() throws DecodingException { byte[] hexDecodeResult = hex.decode(HEX_MSG); assertTrue(Arrays.equals(hexDecodeResult, SOURCE_MSG)); }