@Test
public void testWriteOneInbound() throws InterruptedException {

  final CountDownLatch latch = new CountDownLatch(1);
  final AtomicInteger flushCount = new AtomicInteger(0);
  EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandlerAdapter() {
      @Override
      public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
          ReferenceCountUtil.release(msg);
          latch.countDown();
      }
      @Override
      public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
          flushCount.incrementAndGet();
      }
  });
  channel.writeOneInbound("Hello, Netty!");
  if (!latch.await(1L, TimeUnit.SECONDS)) {
      fail("Nobody called #channelRead() in time.");
  }
  channel.close().syncUninterruptibly();
  // There was no #flushInbound() call so nobody should have called
  // #channelReadComplete()
  assertEquals(0, flushCount.get());
}