public <T> void writeTo(T object, OutputStream entityStream) throws IOException {
        ObjectWriter writer = objectWriterByClass.get(object.getClass());
        if (writer == null) {
            mapper.writeValue(entityStream, object);
        } else {
            writer.writeValue(entityStream, object);
        }
    }
@Test
    public void testApplicationJacksonEncodeXStreamDecode() throws Exception {
        // Encode
        ByteArrayOutputStream captureStream = new ByteArrayOutputStream();
        codec.writeTo(APPLICATION_1, captureStream);
        byte[] encoded = captureStream.toByteArray();

        // Decode
        InputStream source = new ByteArrayInputStream(encoded);
        Application decoded = (Application) new EntityBodyConverter().read(source, Application.class, MediaType.APPLICATION_JSON_TYPE);

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