"This Client is not connected to a server so this call cannot be completed!")));
} else {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte protocolVersion = CougarProtocol.getProtocolVersion(session);
final CougarObjectOutput out = objectIOFactory.newCougarObjectOutput(baos, protocolVersion);
// addObserver(correlationId, def.getReturnType(), observer);
marshaller.writeInvocationRequest(new InvocationRequest() {
@Override
public Object[] getArgs() {
return args;
}
@Override
public ExecutionContext getExecutionContext() {
return ctx;
}
@Override
public OperationKey getOperationKey() {
return def.getOperationKey();
}
@Override
public Parameter[] getParameters() {
return def.getParameters();
}
@Override
public TimeConstraints getTimeConstraints() {
return timeConstraints;
}
}, out, getIdentityResolver(), protocolVersion);
out.close();
((RequestResponseManager) session.getAttribute(RequestResponseManager.SESSION_KEY)).sendRequest(baos.toByteArray(), new RequestResponseManager.ResponseHandler() {
@Override
public void responseReceived(ResponseMessage message) {
CougarObjectInput in = objectIOFactory.newCougarObjectInput(new ByteArrayInputStream(message.getPayload()), CougarProtocol.getProtocolVersion(session));