Package com.rabbitmq.client.impl

Examples of com.rabbitmq.client.impl.Frame


        expectUnexpectedFrameError(new Confuser() {
            public Frame confuse(Frame frame) {
                if (frame.type == AMQP.FRAME_METHOD) {
                    // We can't just skip the method as that will lead us to
                    // send 0 bytes and hang waiting for a response.
                    return new Frame(AMQP.FRAME_HEADER,
                                     frame.channel, frame.getPayload());
                }
                return frame;
            }
        });
View Full Code Here


    public void testWrongClassInHeader() throws IOException {
        expectUnexpectedFrameError(new Confuser() {
            public Frame confuse(Frame frame) {
                if (frame.type == AMQP.FRAME_HEADER) {
                    byte[] payload = frame.getPayload();
                    Frame confusedFrame = new Frame(AMQP.FRAME_HEADER,
                                                    frame.channel, payload);
                    // First two bytes = class ID, must match class ID from
                    // method.
                    payload[0] = 12;
                    payload[1] = 34;
View Full Code Here

    public void testHeartbeatOnChannel() throws IOException {
        expectUnexpectedFrameError(new Confuser() {
            public Frame confuse(Frame frame) {
                if (frame.type == AMQP.FRAME_METHOD) {
                    return new Frame(AMQP.FRAME_HEARTBEAT, frame.channel);
                }
                return frame;
            }
        });
    }
View Full Code Here

    public void testUnknownFrameType() throws IOException {
        expectError(AMQP.FRAME_ERROR, new Confuser() {
            public Frame confuse(Frame frame) {
                if (frame.type == AMQP.FRAME_METHOD) {
                    return new Frame(0, frame.channel,
                                     "1234567890\0001234567890".getBytes());
                }
                return frame;
            }
        });
View Full Code Here

        @Override
        public void writeFrame(Frame frame) throws IOException {
            if (confusedOnce) {
                super.writeFrame(frame);
            } else {
                Frame confusedFrame = confuser.confuse(frame);
                if (confusedFrame != frame) confusedOnce = true;
                if (confusedFrame != null) {
                    super.writeFrame(confusedFrame);
                }
            }
View Full Code Here

        {
            super(socket);
        }

        public Frame readFrame() throws IOException {
            Frame f = super.readFrame();
            int size = f.getPayload().length;
            if (size > REAL_FRAME_MAX)
                fail("Received frame of size " + size
                     + ", which exceeds " + REAL_FRAME_MAX + ".");
            //System.out.printf("Received a frame of size %d.\n", f.getPayload().length);
            return f;
View Full Code Here

        super.tearDown();
    }

    public void testNoMethod() throws Exception {
        List<Frame> frames = new ArrayList<Frame>();
        frames.add(new Frame(AMQP.FRAME_HEADER, 0));
        myFrameHandler.setFrames(frames.iterator());

        try {
            new AMQConnection(factory.getUsername(),
                              factory.getPassword(),
View Full Code Here

                report(frame.channel, frame);
            }
        }

        private void doFrame() throws IOException {
            Frame frame = readFrame();

            if (frame != null) {
                if (this.silentMode) {
                    frame.writeTo(this.outStream);
                    return;
                }
                if (frame.type == AMQP.FRAME_HEARTBEAT) {
                    if (this.writeHeartBeats) {
                        frame.writeTo(this.outStream);
                        report(frame.channel, frame);
                    } else {
                        report(frame.channel, "(withheld) " + frame.toString());
                    }
                } else {
                    frame.writeTo(this.outStream);
                    if (this.noDecodeFrames) {
                        report(frame.channel, frame);
                    } else if (this.noAssembleFrames) {
                        reportFrame(frame);
                    } else {
View Full Code Here

        {
            super(socket);
        }

        public Frame readFrame() throws IOException {
            Frame f = super.readFrame();
            int size = f.getPayload().length;
            if (size > REAL_FRAME_MAX)
                fail("Received frame of size " + size
                     + ", which exceeds " + REAL_FRAME_MAX + ".");
            //System.out.printf("Received a frame of size %d.\n", f.getPayload().length);
            return f;
View Full Code Here

        expectUnexpectedFrameError(new Confuser() {
            public Frame confuse(Frame frame) {
                if (frame.type == AMQP.FRAME_METHOD) {
                    // We can't just skip the method as that will lead us to
                    // send 0 bytes and hang waiting for a response.
                    Frame confusedFrame = new Frame(AMQP.FRAME_HEADER,
                                                    frame.channel,
                                                    frame.getPayload());
                    return confusedFrame;
                }
                return frame;
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.impl.Frame

Copyright © 2018 www.massapicom. 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.