Package org.jboss.aerogear.io.netty.handler.codec.sockjs.protocol

Examples of org.jboss.aerogear.io.netty.handler.codec.sockjs.protocol.CloseFrame


            handleSession(ctx);
        }
    }

    private static void writeCloseFrame(final ChannelHandlerContext ctx, final int code, final String message) {
        ctx.channel().writeAndFlush(new CloseFrame(code, message));
    }
View Full Code Here


        @Override
        public void close() {
            sessionState.onClose();
            final Channel channel = sessionState.getSendingContext().channel();
            if (isWritable(channel)) {
                final CloseFrame closeFrame = new CloseFrame(3000, "Go away!");
                if (logger.isDebugEnabled()) {
                    logger.debug("Writing {}", closeFrame);
                }
                channel.writeAndFlush(closeFrame).addListener(ChannelFutureListener.CLOSE);
            }
View Full Code Here

        assertThat(response.content().toString(CharsetUtil.UTF_8), equalTo("callback(\"o\");\r\n"));
    }

    @Test
    public void flushCloseFrame() {
        final FullHttpResponse response = writeFrame(new CloseFrame(2000, "Oh no"));
        assertThat(response.getStatus(), equalTo(HttpResponseStatus.OK));
        SockJsTestUtil.verifyNoCacheHeaders(response);
        assertThat(response.content().toString(CharsetUtil.UTF_8), equalTo("callback(\"c[2000,\\\"Oh no\\\"]\");\r\n"));
    }
View Full Code Here

public class FramesTest {

    @Test
    public void copy() {
        assertCopy(new MessageFrame("testing copy"));
        assertCopy(new CloseFrame(100, "msg"));
        assertCopy(new HeartbeatFrame());
        assertCopy(new OpenFrame());
        assertCopy(new PreludeFrame());
    }
View Full Code Here

    }

    @Test
    public void duplicate() {
        assertDuplicate(new MessageFrame("testing duplicate"));
        assertDuplicate(new CloseFrame(101, "msg"));
        assertDuplicate(new HeartbeatFrame());
        assertDuplicate(new OpenFrame());
        assertDuplicate(new PreludeFrame());
    }
View Full Code Here

    }

    @Test
    public void retain() {
        assertRetain(new MessageFrame("testing retain"));
        assertRetain(new CloseFrame(102, "msg"));
        assertRetainImmutable(new HeartbeatFrame());
        assertRetainImmutable(new OpenFrame());
        assertRetainImmutable(new PreludeFrame());
    }
View Full Code Here

public class CloseFrameTest {

    @Test
    public void content() {
        final CloseFrame closeFrame = new CloseFrame(3000, "Go away!");
        assertThat(closeFrame.content().toString(CharsetUtil.UTF_8), equalTo("c[3000,\"Go away!\"]"));
        closeFrame.release();
    }
View Full Code Here

        case OPEN:
            if (sessionState.isInUse(session)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Another connection still in open for [{}]", session.sessionId());
                }
                ctx.writeAndFlush(new CloseFrame(2010, "Another connection still open"));
                session.setState(States.INTERRUPTED);
            } else {
                session.setInuse();
                session.setOpenContext(ctx);
                sessionState.onOpen(session, ctx);
            }
            break;
        case INTERRUPTED:
            ctx.writeAndFlush(new CloseFrame(1002, "Connection interrupted"));
            break;
        case CLOSED:
            ctx.writeAndFlush(new CloseFrame(3000, "Go away!"));
            session.resetInuse();
            break;
        }
    }
View Full Code Here

    public void close() {
        session.onClose();
        sessionState.onClose();
        final Channel channel = sessionState.getSendingContext(session).channel();
        if (isWritable(channel)) {
            final CloseFrame closeFrame = new CloseFrame(3000, "Go away!");
            if (logger.isDebugEnabled()) {
                logger.debug("Writing {}", closeFrame);
            }
            channel.writeAndFlush(closeFrame).addListener(ChannelFutureListener.CLOSE);
        }
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.io.netty.handler.codec.sockjs.protocol.CloseFrame

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.