@Deprecated(forRemoval=true, since = "13.0")
   public static Object convertOctetStreamToJava(byte[] source, MediaType destination, Marshaller marshaller) {
      if (source == null) return null;
      if (!destination.match(MediaType.APPLICATION_OBJECT)) {
         throw CONTAINER.invalidMediaType(APPLICATION_OBJECT_TYPE, destination.toString());
      }
      String classType = destination.getClassType();
      if (classType == null) return source;

      if (classType.equals("ByteArray")) {
         return source;
      }
      if (destination.hasStringType()) {
         return new String(source, UTF_8);
      }
      try {
         return marshaller.objectFromByteBuffer(source);
      } catch (IOException | IllegalStateException | ClassNotFoundException e) {
         throw CONTAINER.conversionNotSupported(source, MediaType.APPLICATION_OCTET_STREAM_TYPE, destination.toString());
      }
   }
@Test
   public void testOctetStreamToJavaConversion() {
      String value = "It's not an easy thing to meet your maker.";
      byte[] textStream = value.getBytes(UTF_8);
      byte[] randomBytes = new byte[]{23, 23, 34, 1, -1, -123};

      Marshaller marshaller = new ProtoStreamMarshaller();

      MediaType stringType = APPLICATION_OBJECT.withParameter("type", "java.lang.String");
      Object result = StandardConversions.convertOctetStreamToJava(textStream, stringType, marshaller);
      assertEquals(value, result);

      MediaType byteArrayType = APPLICATION_OBJECT.withParameter("type", "ByteArray");
      Object result2 = StandardConversions.convertOctetStreamToJava(textStream, byteArrayType, marshaller);
      assertArrayEquals(textStream, (byte[]) result2);

      Object result3 = StandardConversions.convertOctetStreamToJava(randomBytes, byteArrayType, marshaller);
      assertArrayEquals(randomBytes, (byte[]) result3);

      thrown.expect(EncodingException.class);
      MediaType doubleType = APPLICATION_OBJECT.withParameter("type", "java.lang.Double");
      StandardConversions.convertOctetStreamToJava(randomBytes, doubleType, marshaller);
      System.out.println(thrown);
   }