void release() {
        if (nettyConnectionWriter != null) {
            checkNotNull(nettyConnectionWriter).close(null);
        }
    }
@Test
    void testRelease() {
        MemoryTierSubpartitionProducerAgent subpartitionProducerAgent =
                createSubpartitionProducerAgent();

        AtomicBoolean isClosed = new AtomicBoolean(false);
        TestingNettyConnectionWriter connectionWriter =
                new TestingNettyConnectionWriter.Builder()
                        .setCloseFunction(
                                throwable -> {
                                    isClosed.set(true);
                                    return null;
                                })
                        .build();
        subpartitionProducerAgent.connectionEstablished(connectionWriter);
        subpartitionProducerAgent.release();

        assertThat(isClosed).isTrue();
    }