use of io.netty.channel.local.LocalChannel in project netty by netty.
the class DefaultChannelPipelineTest method testNullName.
@Test
public void testNullName() {
ChannelPipeline pipeline = new LocalChannel().pipeline();
pipeline.addLast(newHandler());
pipeline.addLast(null, newHandler());
pipeline.addFirst(newHandler());
pipeline.addFirst(null, newHandler());
pipeline.addLast("test", newHandler());
pipeline.addAfter("test", null, newHandler());
pipeline.addBefore("test", null, newHandler());
}
use of io.netty.channel.local.LocalChannel in project netty by netty.
the class DefaultChannelPipelineTest method testAddHandlerBeforeRegisteredThenRemove.
@Test(timeout = 3000)
public void testAddHandlerBeforeRegisteredThenRemove() {
final EventLoop loop = group.next();
CheckEventExecutorHandler handler = new CheckEventExecutorHandler(loop);
ChannelPipeline pipeline = new LocalChannel().pipeline();
pipeline.addFirst(handler);
assertFalse(handler.addedPromise.isDone());
group.register(pipeline.channel());
handler.addedPromise.syncUninterruptibly();
pipeline.remove(handler);
handler.removedPromise.syncUninterruptibly();
}
use of io.netty.channel.local.LocalChannel in project netty by netty.
the class DefaultChannelPipelineTest method testNotPinExecutor.
@Test
public void testNotPinExecutor() {
EventExecutorGroup group = new DefaultEventExecutorGroup(2);
ChannelPipeline pipeline = new LocalChannel().pipeline();
pipeline.channel().config().setOption(ChannelOption.SINGLE_EVENTEXECUTOR_PER_GROUP, false);
pipeline.addLast(group, "h1", new ChannelInboundHandlerAdapter());
pipeline.addLast(group, "h2", new ChannelInboundHandlerAdapter());
EventExecutor executor1 = pipeline.context("h1").executor();
EventExecutor executor2 = pipeline.context("h2").executor();
assertNotNull(executor1);
assertNotNull(executor2);
assertNotSame(executor1, executor2);
group.shutdownGracefully(0, 0, TimeUnit.SECONDS);
}
use of io.netty.channel.local.LocalChannel in project netty by netty.
the class DefaultChannelPipelineTest method testCancelConnect.
@Test
public void testCancelConnect() throws Exception {
ChannelPipeline pipeline = new LocalChannel().pipeline();
group.register(pipeline.channel());
ChannelPromise promise = pipeline.channel().newPromise();
assertTrue(promise.cancel(false));
ChannelFuture future = pipeline.connect(new LocalAddress("test"), promise);
assertTrue(future.isCancelled());
}
use of io.netty.channel.local.LocalChannel in project netty by netty.
the class DefaultChannelPipelineTest method testFirstHandlerEmptyPipeline.
@Test
public void testFirstHandlerEmptyPipeline() throws Exception {
ChannelPipeline pipeline = new LocalChannel().pipeline();
assertNull(pipeline.first());
}
Aggregations