@Test
public void writeShouldPreferHighestWeight() throws Http2Exception {

    // Root the streams at the connection and assign weights.
    setPriority(STREAM_A, 0, (short) 50, false);
    setPriority(STREAM_B, 0, (short) 200, false);
    setPriority(STREAM_C, 0, (short) 100, false);
    setPriority(STREAM_D, 0, (short) 100, false);
    updateStream(STREAM_A, 1000, true);
    updateStream(STREAM_B, 1000, true);
    updateStream(STREAM_C, 1000, true);
    updateStream(STREAM_D, 1000, true);
    // Set allocation quantum to 1 so it is easier to see the ratio of total bytes written between each stream.
    distributor.allocationQuantum(1);
    assertTrue(write(1000));
    assertEquals(100, captureWrites(STREAM_A));
    assertEquals(450, captureWrites(STREAM_B));
    assertEquals(225, captureWrites(STREAM_C));
    assertEquals(225, captureWrites(STREAM_D));
}