@Override
    protected InputStream getRequestStream(Exchange exchange) throws SalesforceException {
        InputStream request;
        Message in = exchange.getIn();
        request = in.getBody(InputStream.class);
        if (request == null) {
            AbstractDTOBase dto = in.getBody(AbstractDTOBase.class);
            if (dto != null) {
                // marshall the DTO
                request = getRequestStream(in, dto);
            } else {
                // if all else fails, get body as String
                final String body = in.getBody(String.class);
                if (null == body) {
                    String msg = "Unsupported request message body " + (in.getBody() == null ? null : in.getBody().getClass());
                    throw new SalesforceException(msg, null);
                } else {
                    request = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8));
                }
            }
        }

        return request;
    }
@Test
    public void getRequestStream() throws Exception {
        final SalesforceComponent comp = new SalesforceComponent();
        final SalesforceEndpointConfig conf = new SalesforceEndpointConfig();
        final OperationName op = OperationName.CREATE_BATCH;
        final SalesforceEndpoint endpoint = new SalesforceEndpoint("", comp, conf, op, "");
        final JsonRestProcessor jsonRestProcessor = new JsonRestProcessor(endpoint);
        final DefaultCamelContext context = new DefaultCamelContext();
        final Exchange exchange = new DefaultExchange(context, ExchangePattern.InOut);
        final TestObject doc = new TestObject();
        doc.setCreationDate(ZonedDateTime.of(1717, 1, 2, 3, 4, 5, 6, ZoneId.systemDefault()));

        exchange.getIn().setBody(doc);
        try (InputStream stream = jsonRestProcessor.getRequestStream(exchange);
             InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
            final String result = IOUtils.toString(reader);
            assertThat(result.length()).isLessThanOrEqualTo(104);
        }
    }