@Override
    void announceBufferSize(int newBufferSize) {
        checkState(!isReleased, "Channel released.");

        ResultSubpartitionView view = this.subpartitionView;
        if (view != null) {
            view.notifyNewBufferSize(newBufferSize);
        }
    }
@Test
    void testAnnounceBufferSize() throws Exception {
        // given: Initialized local input channel.
        AtomicInteger lastBufferSize = new AtomicInteger(0);
        TestingResultPartitionManager partitionManager =
                new TestingResultPartitionManager(
                        InputChannelTestUtils.createResultSubpartitionView(true));
        SingleInputGate inputGate = createSingleInputGate(1);
        LocalInputChannel localChannel = createLocalInputChannel(inputGate, partitionManager);
        localChannel.requestSubpartitions();

        localChannel.announceBufferSize(10);

        // when: Release all resources.
        localChannel.releaseAllResources();

        // then: Announcement buffer size should lead to exception.
        assertThatThrownBy(() -> localChannel.announceBufferSize(12))
                .isInstanceOf(IllegalStateException.class);
    }