Message response = getEndpointAdapter().handleMessage(
new DefaultMessage(mailMessageMapper.toXML(createAcceptRequest(from, recipient))));
if (response == null || response.getPayload() == null) {
throw new CitrusRuntimeException("Did not receive accept response. Missing accept response because autoAccept is disabled.");
}
AcceptResponse acceptResponse = null;
if (response.getPayload() instanceof AcceptResponse) {
acceptResponse = (AcceptResponse) response.getPayload();
} else if (response.getPayload() instanceof String) {
acceptResponse = (AcceptResponse) mailMessageMapper.fromXML(response.getPayload().toString());
}
if (acceptResponse == null) {
throw new CitrusRuntimeException("Unable to read accept response from paylaod: " + response);
}
return acceptResponse.isAccept();
}