Examples of ProtocolMessageType


Examples of com.betfair.cougar.netutil.nio.message.ProtocolMessage.ProtocolMessageType

    @Override
    protected boolean doDecode(IoSession session, ByteBuffer buffer, ProtocolDecoderOutput out) throws Exception {
        if (buffer.prefixedDataAvailable(4)) {
            int msgLen = buffer.getInt() - 1; // the message type is not included in the payload.
            ProtocolMessageType pm = ProtocolMessageType.getMessageByMessageType(buffer.get());
            byte[] messageBody;
            // we need to know if we're acting as a client or a server and treat appropriately
            if (pm == ProtocolMessageType.MESSAGE) {
                Boolean b = (Boolean) session.getAttribute(CougarProtocol.IS_SERVER_ATTR_NAME);
                if (b != null) {
View Full Code Here

Examples of com.betfair.cougar.netutil.nio.message.ProtocolMessage.ProtocolMessageType

                buffer = NioUtils.createMessageHeader(0, pm);
                break;

            case MESSAGE_REQUEST:
                RequestMessage req = (RequestMessage) pm;
                ProtocolMessageType reqMsgType = protocolVersion == CougarProtocol.TRANSPORT_PROTOCOL_VERSION_CLIENT_ONLY_RPC ? ProtocolMessageType.MESSAGE : ProtocolMessageType.MESSAGE_REQUEST;
                buffer = NioUtils.createMessageHeader(req.getPayload().length + 8, reqMsgType);
                buffer.putLong(req.getCorrelationId());
                buffer.put(req.getPayload());
                break;
            case MESSAGE_RESPONSE:
                ResponseMessage resp = (ResponseMessage) pm;
                // backwards compatibility with version 1 protocol
                ProtocolMessageType responseType = protocolVersion == CougarProtocol.TRANSPORT_PROTOCOL_VERSION_CLIENT_ONLY_RPC ? ProtocolMessageType.MESSAGE : ProtocolMessageType.MESSAGE_RESPONSE;
                buffer = NioUtils.createMessageHeader(resp.getPayload().length + 8, responseType);
                buffer.putLong(resp.getCorrelationId());
                buffer.put(resp.getPayload());
                break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.