Home / Function/ writeHeadersUsingVoidPromise() — netty Function Reference

writeHeadersUsingVoidPromise() — netty Function Reference

Architecture documentation for the writeHeadersUsingVoidPromise() function in DefaultHttp2ConnectionEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  11c8cfd7_91a9_94d6_cef3_160be3093885["writeHeadersUsingVoidPromise()"]
  aef19477_9a1f_48c4_824a_17c7f3ecbb10["DefaultHttp2ConnectionEncoderTest"]
  11c8cfd7_91a9_94d6_cef3_160be3093885 -->|defined in| aef19477_9a1f_48c4_824a_17c7f3ecbb10
  style 11c8cfd7_91a9_94d6_cef3_160be3093885 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoderTest.java lines 353–374

    @Test
    public void writeHeadersUsingVoidPromise() throws Exception {
        final Throwable cause = new RuntimeException("fake exception");
        when(writer.writeHeaders(eq(ctx), eq(STREAM_ID), any(Http2Headers.class),
                                 anyInt(), anyBoolean(), any(ChannelPromise.class)))
                .then(new Answer<ChannelFuture>() {
                    @Override
                    public ChannelFuture answer(InvocationOnMock invocationOnMock) throws Throwable {
                        ChannelPromise promise = invocationOnMock.getArgument(5);
                        assertFalse(promise.isVoid());
                        return promise.setFailure(cause);
                    }
                });
        createStream(STREAM_ID, false);
        // END_STREAM flag, so that a listener is added to the future.
        encoder.writeHeaders(ctx, STREAM_ID, EmptyHttp2Headers.INSTANCE, 0, true, newVoidPromise(channel));

        verify(writer).writeHeaders(eq(ctx), eq(STREAM_ID), any(Http2Headers.class),
                                    anyInt(), anyBoolean(), any(ChannelPromise.class));
        // When using a void promise, the error should be propagated via the channel pipeline.
        verify(pipeline).fireExceptionCaught(cause);
    }

Domain

Subdomains

Frequently Asked Questions

What does writeHeadersUsingVoidPromise() do?
writeHeadersUsingVoidPromise() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoderTest.java.
Where is writeHeadersUsingVoidPromise() defined?
writeHeadersUsingVoidPromise() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoderTest.java at line 353.

Analyze Your Own Codebase

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

Try Supermodel Free