Example usage for io.netty.handler.codec.http.websocketx Utf8FrameValidator Utf8FrameValidator

List of usage examples for io.netty.handler.codec.http.websocketx Utf8FrameValidator Utf8FrameValidator

Introduction

In this page you can find the example usage for io.netty.handler.codec.http.websocketx Utf8FrameValidator Utf8FrameValidator.

Prototype

Utf8FrameValidator

Source Link

Usage

From source file:reactor.ipc.netty.NettyContextTest.java

License:Open Source License

@Test
public void encoderSupportSkipsOnCloseIfAttributeClosedChannel() {
    AtomicLong closeCount = new AtomicLong();
    NettyContext c = new NettyContext() {
        @Override//www  .  ja v  a  2  s .c  om
        public Channel channel() {
            return channel;
        }

        @Override
        public NettyContext onClose(Runnable onClose) {
            closeCount.incrementAndGet();
            return this;
        }

        @Override
        public NettyContext removeHandler(String name) {
            return this;
        }
    };

    c.markPersistent(false).addHandlerFirst("byteencoder", new Utf8FrameValidator()).addHandlerFirst("encoder",
            new ChannelHandlerAdapter() {
            });

    assertThat(NettyContext.isPersistent(channel), is(false));
    assertThat(closeCount.intValue(), is(0));
}

From source file:reactor.ipc.netty.NettyContextTest.java

License:Open Source License

@Test
public void decoderSupportSkipsOnCloseIfAttributeClosedChannel() {
    AtomicLong closeCount = new AtomicLong();
    NettyContext c = new NettyContext() {
        @Override//from  ww w .j  a  va 2s.c o m
        public Channel channel() {
            return channel;
        }

        @Override
        public NettyContext onClose(Runnable onClose) {
            closeCount.incrementAndGet();
            return this;
        }

        @Override
        public NettyContext removeHandler(String name) {
            return this;
        }
    };

    c.markPersistent(false).addHandlerLast("byteDecoder", new Utf8FrameValidator()).addHandlerLast("decoder",
            new ChannelHandlerAdapter() {
            });

    assertThat(NettyContext.isPersistent(channel), is(false));
    assertThat(closeCount.intValue(), is(0));
}

From source file:reactor.ipc.netty.NettyContextTest.java

License:Open Source License

@Test
public void addDecoderSkipsIfExist() {
    channel.pipeline().addFirst("foo", new Utf8FrameValidator());

    testContext.addHandlerFirst("foo", new LineBasedFrameDecoder(10));

    assertEquals(channel.pipeline().names(), Arrays.asList("foo", "DefaultChannelPipeline$TailContext#0"));
    assertThat(channel.pipeline().get("foo"), is(instanceOf(Utf8FrameValidator.class)));
}

From source file:reactor.ipc.netty.NettyContextTest.java

License:Open Source License

@Test
public void addEncoderSkipsIfExist() {
    channel.pipeline().addFirst("foo", new Utf8FrameValidator());

    testContext.addHandlerFirst("foo", new LineBasedFrameDecoder(10));

    assertEquals(channel.pipeline().names(), Arrays.asList("foo", "DefaultChannelPipeline$TailContext#0"));
    assertThat(channel.pipeline().get("foo"), is(instanceOf(Utf8FrameValidator.class)));
}