Examples of readInbound()


Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        final EmbeddedChannel ch = webSocketChannel(config);
        assertUpgradeRequest(ch);

        ch.writeInbound(new TextWebSocketFrame("[\"x\",\"y\"]"));
        // Discard of the HttpRequest
        ch.readInbound();
        final String x = ch.readInbound();
        assertThat(x, equalTo("x"));
        final String y = ch.readInbound();
        assertThat(y, equalTo("y"));
    }
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        assertUpgradeRequest(ch);

        ch.writeInbound(new TextWebSocketFrame("[\"x\",\"y\"]"));
        // Discard of the HttpRequest
        ch.readInbound();
        final String x = ch.readInbound();
        assertThat(x, equalTo("x"));
        final String y = ch.readInbound();
        assertThat(y, equalTo("y"));
    }
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        ch.writeInbound(new TextWebSocketFrame("[\"x\",\"y\"]"));
        // Discard of the HttpRequest
        ch.readInbound();
        final String x = ch.readInbound();
        assertThat(x, equalTo("x"));
        final String y = ch.readInbound();
        assertThat(y, equalTo("y"));
    }

    @Test
    public void writeJsonString() throws Exception {
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        final EmbeddedChannel ch = webSocketChannel(config);
        assertUpgradeRequest(ch);

        ch.writeInbound(new TextWebSocketFrame("\"x\""));
        // Discard of the HttpRequest
        ch.readInbound();
        final String message = ch.readInbound();
        assertThat(message, equalTo("x"));
    }

    @Test
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        assertUpgradeRequest(ch);

        ch.writeInbound(new TextWebSocketFrame("\"x\""));
        // Discard of the HttpRequest
        ch.readInbound();
        final String message = ch.readInbound();
        assertThat(message, equalTo("x"));
    }

    @Test
    public void firefox602ConnectionHeader() throws Exception {
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

    }

    public static HttpResponse decode(final EmbeddedChannel channel) throws Exception {
        final EmbeddedChannel ch = new EmbeddedChannel(new HttpObjectAggregator(8192), new HttpResponseDecoder());
        ch.writeInbound(channel.readOutbound());
        return (HttpResponse) ch.readInbound();
    }

    public static FullHttpResponse decodeFullResponse(final EmbeddedChannel channel) throws Exception {
        final HttpResponse response = decode(channel);
        final ByteBuf content = channel.readOutbound();
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

    }

    public static FullHttpResponse decodeFullHttpResponse(final EmbeddedChannel channel) throws Exception {
        final EmbeddedChannel ch = new EmbeddedChannel(new HttpResponseDecoder());
        ch.writeInbound(channel.readOutbound());
        final HttpResponse response = ch.readInbound();
        final HttpContent content = ch.readInbound();
        final DefaultFullHttpResponse fullResponse = new DefaultFullHttpResponse(response.getProtocolVersion(),
                response.getStatus(), content.content());
        fullResponse.headers().add(response.headers());
        return fullResponse;
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

    public static FullHttpResponse decodeFullHttpResponse(final EmbeddedChannel channel) throws Exception {
        final EmbeddedChannel ch = new EmbeddedChannel(new HttpResponseDecoder());
        ch.writeInbound(channel.readOutbound());
        final HttpResponse response = ch.readInbound();
        final HttpContent content = ch.readInbound();
        final DefaultFullHttpResponse fullResponse = new DefaultFullHttpResponse(response.getProtocolVersion(),
                response.getStatus(), content.content());
        fullResponse.headers().add(response.headers());
        return fullResponse;
    }
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        final EmbeddedChannel channel = new EmbeddedChannel(new CorsInboundHandler());
        channel.writeInbound(httpRequest);
        final CorsMetadata corsMetadata = channel.attr(CorsInboundHandler.CORS).get();
        assertThat(corsMetadata.origin(), is("*"));
        assertThat(corsMetadata.hasHeaders(), is(false));
        assertThat((FullHttpRequest) channel.readInbound(), equalTo(httpRequest));
        channel.finish();
    }

    @Test
    public void verifyChannelAttributesNotPreflightRequest() {
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.readInbound()

        final EmbeddedChannel channel = new EmbeddedChannel(new CorsInboundHandler());
        channel.writeInbound(httpRequest);
        final CorsMetadata corsMetadata = channel.attr(CorsInboundHandler.CORS).get();
        assertThat(corsMetadata.origin(), is("example.se"));
        assertThat(corsMetadata.headers(), is("content-type"));
        assertThat((HttpRequest) channel.readInbound(), equalTo(httpRequest));
        channel.finish();
    }

    private static FullHttpRequest createHttpRequest(HttpMethod method) {
        return new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, "/info");
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.