@Test(timeout = 3000)
public void testAddBefore() throws Throwable {

    ChannelPipeline pipeline1 = new LocalChannel().pipeline();
    ChannelPipeline pipeline2 = new LocalChannel().pipeline();
    EventLoopGroup defaultGroup = new DefaultEventLoopGroup(2);
    try {
        EventLoop eventLoop1 = defaultGroup.next();
        EventLoop eventLoop2 = defaultGroup.next();
        eventLoop1.register(pipeline1.channel()).syncUninterruptibly();
        eventLoop2.register(pipeline2.channel()).syncUninterruptibly();
        CountDownLatch latch = new CountDownLatch(2 * 10);
        for (int i = 0; i < 10; i++) {
            eventLoop1.execute(new TestTask(pipeline2, latch));
            eventLoop2.execute(new TestTask(pipeline1, latch));
        }
        latch.await();
    } finally {
        defaultGroup.shutdownGracefully();
    }
}