docs: public static byte[] convertJavaToOctetStream(Object source, MediaType sourceMediaType, Marshaller marshaller) throws IOException, InterruptedException {
        if (source == null) return null;
        if (!sourceMediaType.match(MediaType.APPLICATION_OBJECT)) {
           throw new EncodingException("destination MediaType not conforming to application/x-java-object!");
        }
  
        Object decoded = decodeObjectContent(source, sourceMediaType);
        if (decoded instanceof byte[]) return (byte[]) decoded;
        if (decoded instanceof String && isJavaString(sourceMediaType))
           return ((String) decoded).getBytes(StandardCharsets.UTF_8);
        return marshaller.objectToByteBuffer(source);
     }