RequestMessage req = (RequestMessage) message;
final CougarObjectOutput out = objectIOFactory.newCougarObjectOutput(new ByteArrayOutputStreamWithIoSession(session, req.getCorrelationId()), CougarProtocol.getProtocolVersion(session));
final CougarObjectInput in = objectIOFactory.newCougarObjectInput(new ByteArrayInputStream(req.getPayload()), CougarProtocol.getProtocolVersion(session));
final String remoteAddress = ((InetSocketAddress) session.getRemoteAddress()).getAddress().getHostAddress();
final SocketTransportCommandImpl command = new SocketTransportRPCCommandImpl(in, out, remoteAddress, session);
requestsReceived.incrementAndGet();
processor.process(command);
sessionLogger.log(ALL, session, "ExecutionVenueServerHandler - Message %s processed", req.getCorrelationId());
}
else if (message instanceof EventMessage) {
EventMessage em = (EventMessage) message;
final CougarObjectInput in = objectIOFactory.newCougarObjectInput(new ByteArrayInputStream(em.getPayload()), CougarProtocol.getProtocolVersion(session));
final String remoteAddress = ((InetSocketAddress) session.getRemoteAddress()).getAddress().getHostAddress();
final SocketTransportCommandImpl command = new SocketTransportCommandImpl(in, remoteAddress, session);
eventsReceived.incrementAndGet();
processor.process(command);
} else {
LOG.warn("ExecutionVenueServerHandler - Received unexpected message type: " + message + " - closing session");