Examples of writeInbound()


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

    private static FullHttpResponse processHttpRequest(final FullHttpRequest request) {
        final JsonpSendTransport transport = new JsonpSendTransport(SockJsConfig.withPrefix("/test")
                .cookiesNeeded().build());
        final EmbeddedChannel channel = new EmbeddedChannel(transport);
        channel.writeInbound(request);
        final FullHttpResponse response = channel.readOutbound();
        channel.finish();
        return response;
    }
View Full Code Here

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

        final String queryUrl = withCallback ? "/jsonp?c=callback" : "/jsonp";
        final DefaultFullHttpRequest request = new DefaultFullHttpRequest(HTTP_1_1, GET, queryUrl);
        final SockJsConfig config = SockJsConfig.withPrefix(queryUrl).cookiesNeeded().build();
        final JsonpPollingTransport jsonpPollingOutbound = new JsonpPollingTransport(config, request);
        final EmbeddedChannel ch = new EmbeddedChannel(jsonpPollingOutbound);
        ch.writeInbound(request);
        ch.writeOutbound(frame);
        final FullHttpResponse response =  ch.readOutbound();
        ch.finish();
        return response;
    }
View Full Code Here

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

    private static FullHttpResponse processHttpRequest(final FullHttpRequest request) {
        final XhrSendTransport transport = new XhrSendTransport(SockJsConfig.withPrefix("/test")
                .cookiesNeeded().build());
        final EmbeddedChannel channel = new EmbeddedChannel(transport);
        channel.writeInbound(request);
        final FullHttpResponse response = channel.readOutbound();
        channel.finish();
        return response;
    }
View Full Code Here

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

    // 2. random slices
    buf.readerIndex(0);
    ByteBuf[] slices = randomSlices(buf);

    ch.writeInbound((Object[]) slices);

    for (ByteBuf slice : slices) {
      Assert.assertEquals(1, slice.refCnt());
    }
View Full Code Here

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

    ByteBuf[] slices = randomSlices(buf);

    for (ByteBuf slice : slices) {
      int refCount = slice.refCnt();
      ch.writeInbound(slice);

      // registered BufferAvailabilityListener => call bufferAvailable(buffer)
      while (randomBufferAvailabilityRegistrationAnswer.isRegistered()) {
        randomBufferAvailabilityRegistrationAnswer.unregister();
View Full Code Here

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

        ch1.writeInbound(webSocketUpgradeRequest(sessionUrl + "/websocket", WebSocketVersion.V00));
        final FullHttpResponse upgradeResponse = HttpUtil.decodeFullHttpResponse(ch1);
        assertThat(upgradeResponse.content().toString(UTF_8), equalTo("8jKS'y:G*Co,Wxa-"));

        ch2.writeInbound(webSocketUpgradeRequest(sessionUrl + "/websocket", WebSocketVersion.V00));
        final FullHttpResponse upgradeResponse2 = HttpUtil.decodeFullHttpResponse(ch2);
        assertThat(upgradeResponse2.content().toString(UTF_8), equalTo("8jKS'y:G*Co,Wxa-"));

        assertThat(((ByteBufHolder) ch1.readOutbound()).content().toString(UTF_8), equalTo("o"));
        assertThat(((ByteBufHolder) ch2.readOutbound()).content().toString(UTF_8), equalTo("o"));
View Full Code Here

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

        assertThat(((ByteBufHolder) ch2.readOutbound()).content().toString(UTF_8), equalTo("o"));

        ch1.writeInbound(new TextWebSocketFrame("\"a\""));
        assertThat(((ByteBufHolder) ch1.readOutbound()).content().toString(UTF_8), equalTo("a[\"a\"]"));

        ch2.writeInbound(new TextWebSocketFrame("\"b\""));
        assertThat(((ByteBufHolder) ch2.readOutbound()).content().toString(UTF_8), equalTo("a[\"b\"]"));

        ch1.close();
        ch2.close();
View Full Code Here

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

        ch1.close();
        ch2.close();

        final EmbeddedChannel newCh = wsChannelForService(echoFactory);

        newCh.writeInbound(webSocketUpgradeRequest(sessionUrl + "/websocket"));
        final FullHttpResponse upgradeResponse3 = HttpUtil.decodeFullHttpResponse(newCh);
        assertThat(upgradeResponse3.getStatus(), equalTo(HttpResponseStatus.SWITCHING_PROTOCOLS));

        assertThat(((ByteBufHolder) readOutboundDiscardEmpty(newCh)).content().toString(UTF_8), equalTo("o"));
        newCh.writeInbound(new TextWebSocketFrame("\"a\""));
View Full Code Here

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

        newCh.writeInbound(webSocketUpgradeRequest(sessionUrl + "/websocket"));
        final FullHttpResponse upgradeResponse3 = HttpUtil.decodeFullHttpResponse(newCh);
        assertThat(upgradeResponse3.getStatus(), equalTo(HttpResponseStatus.SWITCHING_PROTOCOLS));

        assertThat(((ByteBufHolder) readOutboundDiscardEmpty(newCh)).content().toString(UTF_8), equalTo("o"));
        newCh.writeInbound(new TextWebSocketFrame("\"a\""));
        assertThat(((ByteBufHolder) newCh.readOutbound()).content().toString(UTF_8), equalTo("a[\"a\"]"));
        newCh.close();
    }

    /*
 
View Full Code Here

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

        request.headers().set(CONNECTION, "Upgrade");
        request.headers().set(CONNECTION, "Upgrade");
        request.headers().set(SEC_WEBSOCKET_KEY1, "4 @1  46546xW%0l 1 5");
        request.headers().set(SEC_WEBSOCKET_KEY2, "12998 5 Y3 1  .P00");
        request.headers().set(ORIGIN, "http://example.com");
        ch.writeInbound(request);

        final HttpResponse upgradeResponse = HttpUtil.decode(ch);
        assertThat(upgradeResponse.getStatus(), equalTo(HttpResponseStatus.SWITCHING_PROTOCOLS));

        ch.writeInbound(Unpooled.copiedBuffer("^n:ds[4U", CharsetUtil.US_ASCII));
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.