public void responseReceived(ResponseMessage message) {
CougarObjectInput in = objectIOFactory.newCougarObjectInput(new ByteArrayInputStream(message.getPayload()), CougarProtocol.getProtocolVersion(session));
try {
EnumUtils.setHardFailureForThisThread(hardFailEnumDeserialisation);
InvocationResponse response = marshaller.readInvocationResponse(def.getReturnType(), in);
// connected object calls need some additional setup prior to responding to the observer
if (def.getOperationKey().getType() == OperationKey.Type.ConnectedObject && response.isSuccess()) {
connectedObjectManager.handleSubscriptionResponse(session, response, observer);
}
else {
response.recreate(observer, def.getReturnType(), message.getPayload().length);
}
} catch (Exception e) {
observer.onResult(new ExecutionResult(new CougarClientException(CougarMarshallingException.unmarshallingException("binary", "Unable to deserialise response, closing session", e, true))));
if (session.isConnected()) {
logger.log(NioLogger.LoggingLevel.SESSION, session, "Error occurred whilst trying to deserialise response, closing session");