Home / Class/ DefaultHttp2RemoteFlowControllerTest Class — netty Architecture

DefaultHttp2RemoteFlowControllerTest Class — netty Architecture

Architecture documentation for the DefaultHttp2RemoteFlowControllerTest class in DefaultHttp2RemoteFlowControllerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f["DefaultHttp2RemoteFlowControllerTest"]
  151982d5_edbe_2785_5895_4670aa555104["DefaultHttp2RemoteFlowControllerTest.java"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|defined in| 151982d5_edbe_2785_5895_4670aa555104
  9fed0499_471e_ac3f_c01d_022267ff0534["setup()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 9fed0499_471e_ac3f_c01d_022267ff0534
  48ea6576_428e_6994_44ee_52a632fc5fea["StreamByteDistributor()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 48ea6576_428e_6994_44ee_52a632fc5fea
  3a8492ba_178f_22a5_9eb6_dfa34ba2d102["initConnectionAndController()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 3a8492ba_178f_22a5_9eb6_dfa34ba2d102
  c5c060aa_8632_91ed_8225_abce4cb795ef["initialWindowSizeShouldOnlyChangeStreams()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| c5c060aa_8632_91ed_8225_abce4cb795ef
  ef28a258_356b_c47b_6050_279264ee0398["windowUpdateShouldChangeConnectionWindow()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| ef28a258_356b_c47b_6050_279264ee0398
  787ea31a_15c1_ceba_c30f_31aa0bd170d4["windowUpdateShouldChangeStreamWindow()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 787ea31a_15c1_ceba_c30f_31aa0bd170d4
  b49f8173_f52c_2c10_ad24_9b9966426113["payloadSmallerThanWindowShouldBeWrittenImmediately()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| b49f8173_f52c_2c10_ad24_9b9966426113
  f926ed4a_aaa9_296b_18ba_579835944b67["emptyPayloadShouldBeWrittenImmediately()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| f926ed4a_aaa9_296b_18ba_579835944b67
  ce70dc90_cde8_28bb_d6d0_32aaf1b153a5["unflushedPayloadsShouldBeDroppedOnCancel()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| ce70dc90_cde8_28bb_d6d0_32aaf1b153a5
  4c3b0295_1dae_fc9f_14a3_3ac54290b901["payloadsShouldMerge()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 4c3b0295_1dae_fc9f_14a3_3ac54290b901
  bf6afd63_d0f3_c0c1_650b_23b14a5e50a4["flowControllerCorrectlyAccountsForBytesWithMerge()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| bf6afd63_d0f3_c0c1_650b_23b14a5e50a4
  0283bdad_ac0d_dd78_784e_45b421692e2d["stalledStreamShouldQueuePayloads()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 0283bdad_ac0d_dd78_784e_45b421692e2d
  5be33bbd_ea57_0bc5_f862_e6ea4b476f8d["queuedPayloadsReceiveErrorOnStreamClose()"]
  f8fd7697_92d4_6455_4dd8_09a33ac81a6f -->|method| 5be33bbd_ea57_0bc5_f862_e6ea4b476f8d

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowControllerTest.java lines 62–1146

public abstract class DefaultHttp2RemoteFlowControllerTest {
    private static final int STREAM_A = 1;
    private static final int STREAM_B = 3;
    private static final int STREAM_C = 5;
    private static final int STREAM_D = 7;

    private DefaultHttp2RemoteFlowController controller;

    @Mock
    private ChannelHandlerContext ctx;

    @Mock
    private Channel channel;

    @Mock
    private ChannelConfig config;

    @Mock
    private EventExecutor executor;

    @Mock
    private ChannelPromise promise;

    @Mock
    private Http2RemoteFlowController.Listener listener;

    private DefaultHttp2Connection connection;

    @BeforeEach
    public void setup() throws Http2Exception {
        MockitoAnnotations.initMocks(this);

        when(ctx.newPromise()).thenReturn(promise);
        when(ctx.flush()).thenThrow(new AssertionFailedError("forbidden"));
        setChannelWritability(true);
        when(channel.config()).thenReturn(config);
        when(executor.inEventLoop()).thenReturn(true);

        initConnectionAndController();

        resetCtx();
        // This is intentionally left out of initConnectionAndController so it can be tested below.
        controller.channelHandlerContext(ctx);
        assertWritabilityChanged(1, true);
        reset(listener);
    }

    protected abstract StreamByteDistributor newDistributor(Http2Connection connection);

    private void initConnectionAndController() throws Http2Exception {
        connection = new DefaultHttp2Connection(false);
        controller = new DefaultHttp2RemoteFlowController(connection, newDistributor(connection), listener);
        connection.remote().flowController(controller);

        connection.local().createStream(STREAM_A, false);
        connection.local().createStream(STREAM_B, false);
        Http2Stream streamC = connection.local().createStream(STREAM_C, false);
        Http2Stream streamD = connection.local().createStream(STREAM_D, false);
        controller.updateDependencyTree(streamC.id(), STREAM_A, DEFAULT_PRIORITY_WEIGHT, false);
        controller.updateDependencyTree(streamD.id(), STREAM_A, DEFAULT_PRIORITY_WEIGHT, false);
    }

    @Test
    public void initialWindowSizeShouldOnlyChangeStreams() throws Http2Exception {
        controller.initialWindowSize(0);
        assertEquals(DEFAULT_WINDOW_SIZE, window(CONNECTION_STREAM_ID));
        assertEquals(0, window(STREAM_A));
        assertEquals(0, window(STREAM_B));
        assertEquals(0, window(STREAM_C));
        assertEquals(0, window(STREAM_D));
        assertWritabilityChanged(1, false);
    }

    @Test
    public void windowUpdateShouldChangeConnectionWindow() throws Http2Exception {
        incrementWindowSize(CONNECTION_STREAM_ID, 100);
        assertEquals(DEFAULT_WINDOW_SIZE + 100, window(CONNECTION_STREAM_ID));
        assertEquals(DEFAULT_WINDOW_SIZE, window(STREAM_A));
        assertEquals(DEFAULT_WINDOW_SIZE, window(STREAM_B));
        assertEquals(DEFAULT_WINDOW_SIZE, window(STREAM_C));
        assertEquals(DEFAULT_WINDOW_SIZE, window(STREAM_D));

Frequently Asked Questions

What is the DefaultHttp2RemoteFlowControllerTest class?
DefaultHttp2RemoteFlowControllerTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowControllerTest.java.
Where is DefaultHttp2RemoteFlowControllerTest defined?
DefaultHttp2RemoteFlowControllerTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowControllerTest.java at line 62.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free