@Test
  public void testServerWrite() {
    int maxFrameSize = 2001;
    EmbeddedChannel channel = new EmbeddedChannel(new AmbrySendToHttp2Adaptor(true, maxFrameSize));
    int contentSize = 7000;
    byte[] byteArray = new byte[contentSize];
    new Random().nextBytes(byteArray);
    ByteBuf content = PooledByteBufAllocator.DEFAULT.heapBuffer(contentSize).writeBytes(byteArray);
    // Retain the ByteBuf for data comparison
    content.retain();
    Send send = new MockSend(content);
    channel.writeOutbound(send);

    DefaultHttp2HeadersFrame header = channel.readOutbound();
    Assert.assertNotNull(header.headers());
    Assert.assertEquals(header.headers().status().toString(), "200");

    byte[] resultArray = new byte[contentSize];
    int i;
    for (i = 0; i < contentSize / maxFrameSize; i++) {
      DefaultHttp2DataFrame data = channel.readOutbound();
      data.content().readBytes(resultArray, i * maxFrameSize, maxFrameSize);
      data.content().release();
    }
    // The last frame
    DefaultHttp2DataFrame data = channel.readOutbound();
    data.content().readBytes(resultArray, i * maxFrameSize, data.content().readableBytes());
    data.content().release();
    Assert.assertArrayEquals(byteArray, resultArray);
    content.release();
  }
Test when write {@link Send} from server to client. There are two cases tested in this method
1. {@link Send} returns a non-null value for {@link Send#content()} method.
2. {@link Send} returns a null value for {@link Send#content()} method.
Make sure both cases don't leak memory.
@throws Exception
ambry-network/src/test/java/com/github/ambry/network/http2/AmbrySendToHttp2AdaptorTest.java