Package io.netty.channel.embedded

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


        // Ensure exceeding the low watermark does not make channel unwritable.
        ch.write(buffer().writeZero(128));
        assertThat(buf.toString(), is(""));

        ch.unsafe().outboundBuffer().addFlush();

        // Ensure exceeding the high watermark makes channel unwritable.
        ch.write(buffer().writeZero(128));
        assertThat(buf.toString(), is("false "));
View Full Code Here


        // Ensure exceeding the high watermark makes channel unwritable.
        ch.write(buffer().writeZero(128));
        assertThat(buf.toString(), is("false "));

        // Ensure going down to the low watermark makes channel writable again by flushing the first write.
        assertThat(ch.unsafe().outboundBuffer().remove(), is(true));
        assertThat(ch.unsafe().outboundBuffer().totalPendingWriteBytes(), is(128L));
        assertThat(buf.toString(), is("false true "));

        safeClose(ch);
    }
View Full Code Here

        ch.write(buffer().writeZero(128));
        assertThat(buf.toString(), is("false "));

        // Ensure going down to the low watermark makes channel writable again by flushing the first write.
        assertThat(ch.unsafe().outboundBuffer().remove(), is(true));
        assertThat(ch.unsafe().outboundBuffer().totalPendingWriteBytes(), is(128L));
        assertThat(buf.toString(), is("false true "));

        safeClose(ch);
    }
View Full Code Here

        });

        ch.config().setWriteBufferLowWaterMark(128);
        ch.config().setWriteBufferHighWaterMark(256);

        ChannelOutboundBuffer cob = ch.unsafe().outboundBuffer();

        // Ensure that the default value of a user-defined writability flag is true.
        for (int i = 1; i <= 30; i ++) {
            assertThat(cob.getUserDefinedWritability(i), is(true));
        }
View Full Code Here

        });

        ch.config().setWriteBufferLowWaterMark(128);
        ch.config().setWriteBufferHighWaterMark(256);

        ChannelOutboundBuffer cob = ch.unsafe().outboundBuffer();

        // Ensure that setting a user-defined writability flag to false affects channel.isWritable()
        cob.setUserDefinedWritability(1, false);
        assertThat(buf.toString(), is("false "));
View Full Code Here

        });

        ch.config().setWriteBufferLowWaterMark(128);
        ch.config().setWriteBufferHighWaterMark(256);

        ChannelOutboundBuffer cob = ch.unsafe().outboundBuffer();

        // Trigger channelWritabilityChanged() by writing a lot.
        ch.write(buffer().writeZero(256));
        assertThat(buf.toString(), is("false "));
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.