Examples of writeOutbound()


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

import org.apache.spark.network.util.NettyUtils;

public class ProtocolSuite {
  private void testServerToClient(Message msg) {
    EmbeddedChannel serverChannel = new EmbeddedChannel(new MessageEncoder());
    serverChannel.writeOutbound(msg);

    EmbeddedChannel clientChannel = new EmbeddedChannel(
        NettyUtils.createFrameDecoder(), new MessageDecoder());

    while (!serverChannel.outboundMessages().isEmpty()) {
View Full Code Here

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

    assertEquals(msg, clientChannel.readInbound());
  }

  private void testClientToServer(Message msg) {
    EmbeddedChannel clientChannel = new EmbeddedChannel(new MessageEncoder());
    clientChannel.writeOutbound(msg);

    EmbeddedChannel serverChannel = new EmbeddedChannel(
        NettyUtils.createFrameDecoder(), new MessageDecoder());

    while (!clientChannel.outboundMessages().isEmpty()) {
View Full Code Here

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

        for (int i = 1; i < 10; i++) {
            buf.writeInt(i * -1);
        }

        EmbeddedChannel channel = new EmbeddedChannel(new AbsIntegerEncoder());
        Assert.assertTrue(channel.writeOutbound(buf));

        Assert.assertTrue(channel.finish());
        ByteBuf output = (ByteBuf) channel.readOutbound();
        for (int i = 1; i < 10; i++) {
            Assert.assertEquals(i, output.readInt());
View Full Code Here

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

    @Test
    public void testMemcachedRequestEncoder() {
        MemcachedRequest request = new MemcachedRequest(Opcode.SET, "key1", "value1");

        EmbeddedChannel channel = new EmbeddedChannel(new MemcachedRequestEncoder());
        channel.writeOutbound(request);

        ByteBuf encoded = (ByteBuf) channel.readOutbound();

        Assert.assertNotNull(encoded);
        Assert.assertEquals(request.magic(), encoded.readByte());
View Full Code Here

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

        env.setBuffer(buffer);

        expectedEncodedMsgSize += bufferSize;
      }

      Assert.assertTrue(channel.writeOutbound(env));

      // --------------------------------------------------------------------
      // verify encoded ByteBuf size
      // --------------------------------------------------------------------
      ByteBuf encodedMsg = (ByteBuf) channel.readOutbound();
View Full Code Here

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

        BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true,
                WebSocketExtension.RSV3 | WebSocketExtension.RSV1, Unpooled.wrappedBuffer(payload));

        // execute
        encoderChannel.writeOutbound(frame);
        BinaryWebSocketFrame newFrame = encoderChannel.readOutbound();

        // test
        assertNotNull(newFrame);
        assertNotNull(newFrame.content());
View Full Code Here

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

        BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true,
                WebSocketExtension.RSV3 | WebSocketExtension.RSV1, Unpooled.wrappedBuffer(payload));

        // execute
        encoderChannel.writeOutbound(frame);
        BinaryWebSocketFrame newFrame = encoderChannel.readOutbound();

        // test
        assertNotNull(newFrame);
        assertNotNull(newFrame.content());
View Full Code Here

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

        // execute
        EmbeddedChannel ch = new EmbeddedChannel(new WebSocketClientExtensionHandler(
                mainHandshakerMock, fallbackHandshakerMock));

        HttpRequest req = newUpgradeRequest(null);
        ch.writeOutbound(req);

        HttpRequest req2 = ch.readOutbound();
        List<WebSocketExtensionData> reqExts = WebSocketExtensionUtil.extractExtensions(
                req2.headers().getAndConvert(HttpHeaderNames.SEC_WEBSOCKET_EXTENSIONS));
View Full Code Here

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

    // Test for https://github.com/netty/netty/issues/2768
    @Test
    public void testMultipleWebSocketCloseFrames() {
        EmbeddedChannel channel = new EmbeddedChannel(new WebSocket00FrameEncoder());
        Assert.assertTrue(channel.writeOutbound(new CloseWebSocketFrame()));
        Assert.assertTrue(channel.writeOutbound(new CloseWebSocketFrame()));
        Assert.assertTrue(channel.finish());
        assertCloseWebSocketFrame(channel);
        assertCloseWebSocketFrame(channel);
        Assert.assertNull(channel.readOutbound());
View Full Code Here

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

    // Test for https://github.com/netty/netty/issues/2768
    @Test
    public void testMultipleWebSocketCloseFrames() {
        EmbeddedChannel channel = new EmbeddedChannel(new WebSocket00FrameEncoder());
        Assert.assertTrue(channel.writeOutbound(new CloseWebSocketFrame()));
        Assert.assertTrue(channel.writeOutbound(new CloseWebSocketFrame()));
        Assert.assertTrue(channel.finish());
        assertCloseWebSocketFrame(channel);
        assertCloseWebSocketFrame(channel);
        Assert.assertNull(channel.readOutbound());
    }
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.