@Test
  public void testGetID() throws Exception {
    Channel channel = createChannel();
    NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false);

    Assert.assertEquals(channel.hashCode(), conn.getID());
  }
  @Test
  public void testCreateBuffer() throws Exception {
    EmbeddedChannel channel = createChannel();
    NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false);

    final int size = 1234;

    ActiveMQBuffer buff = conn.createTransportBuffer(size);
    buff.writeByte((byte) 0x00); // Netty buffer does lazy initialization.
    Assert.assertEquals(size, buff.capacity());
  }
  @Test
  public void testWrite() throws Exception {
    ActiveMQBuffer buff = ActiveMQBuffers.wrappedBuffer(ByteBuffer.allocate(128));
    EmbeddedChannel channel = createChannel();

    Assert.assertEquals(0, channel.outboundMessages().size());

    NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false);
    conn.write(buff);
    channel.runPendingTasks();
    Assert.assertEquals(1, channel.outboundMessages().size());
  }