@Test
public void testSpdySettingsPersistedValues() throws Exception {

    short type = 4;
    byte flags = 0;
    int numSettings = 1;
    int length = 8 * numSettings + 4;
    byte idFlags = 0x02; // FLAG_SETTINGS_PERSISTED
    int id = RANDOM.nextInt() & 0x00FFFFFF;
    int value = RANDOM.nextInt();
    ByteBuf buf = Unpooled.buffer(SPDY_HEADER_SIZE + length);
    encodeControlFrameHeader(buf, type, flags, length);
    buf.writeInt(numSettings);
    for (int i = 0; i < numSettings; i++) {
        buf.writeByte(idFlags);
        buf.writeMedium(id);
        buf.writeInt(value);
    }
    delegate.readSettingsEnd();
    decoder.decode(buf);
    verify(delegate).readSettingsFrame(false);
    verify(delegate, times(numSettings)).readSetting(id, value, false, true);
    assertFalse(buf.isReadable());
    buf.release();
}