public <T> T readValue(Class<T> type, InputStream entityStream) throws IOException {
        ObjectReader reader = DeserializerStringCache.init(
                Optional.ofNullable(objectReaderByClass.get(type)).map(Supplier::get).orElseGet(()->mapper.readerFor(type))
                );
        try {
            return reader.readValue(entityStream);
        }
        finally {
            DeserializerStringCache.clear(reader, CacheScope.GLOBAL_SCOPE);
        }
    }
@Test
    public void testApplicationsXStreamEncodeJacksonDecode() throws Exception {
        Applications original = APPLICATIONS;

        // Encode
        ByteArrayOutputStream captureStream = new ByteArrayOutputStream();
        new EntityBodyConverter().write(original, captureStream, MediaType.APPLICATION_JSON_TYPE);
        byte[] encoded = captureStream.toByteArray();
        String encodedString = new String(encoded);
        // Decode
        InputStream source = new ByteArrayInputStream(encoded);
        Applications decoded = codec.readValue(Applications.class, source);

        assertTrue(EurekaEntityComparators.equal(decoded, original));
    }