use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPromise in project netty by netty.
the class DefaultHttp2ConnectionEncoderTest method tooManyHeadersWithDataThrows.
private void tooManyHeadersWithDataThrows(boolean eos) {
writeAllFlowControlledFrames();
final int streamId = 6;
ChannelPromise promise = newPromise();
encoder.writeHeaders(ctx, streamId, EmptyHttp2Headers.INSTANCE, 0, false, promise);
Http2Stream stream = connection.stream(streamId);
when(remoteFlow.hasFlowControlled(eq(stream))).thenReturn(true);
ChannelPromise promise2 = newPromise();
encoder.writeHeaders(ctx, streamId, EmptyHttp2Headers.INSTANCE, 0, true, promise2);
ChannelPromise promise3 = newPromise();
ChannelFuture future = encoder.writeHeaders(ctx, streamId, EmptyHttp2Headers.INSTANCE, 0, eos, promise3);
assertTrue(future.isDone());
assertFalse(future.isSuccess());
verify(writer, times(1)).writeHeaders(eq(ctx), eq(streamId), eq(EmptyHttp2Headers.INSTANCE), eq(0), eq(false), eq(promise));
verify(writer, times(1)).writeHeaders(eq(ctx), eq(streamId), eq(EmptyHttp2Headers.INSTANCE), eq(0), eq(true), eq(promise2));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPromise in project netty by netty.
the class DefaultHttp2ConnectionEncoderTest method pingWriteShouldSucceed.
@Test
public void pingWriteShouldSucceed() throws Exception {
ChannelPromise promise = newPromise();
encoder.writePing(ctx, false, 0L, promise);
verify(writer).writePing(eq(ctx), eq(false), eq(0L), eq(promise));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPromise in project netty by netty.
the class DefaultHttp2ConnectionEncoderTest method priorityWriteOnPreviouslyExistingParentStreamShouldSucceed.
@Test
public void priorityWriteOnPreviouslyExistingParentStreamShouldSucceed() throws Exception {
final int parentStreamId = STREAM_ID + 2;
createStream(STREAM_ID, false);
createStream(parentStreamId, false).close();
ChannelPromise promise = newPromise();
short weight = 255;
encoder.writePriority(ctx, STREAM_ID, parentStreamId, weight, true, promise);
verify(writer).writePriority(eq(ctx), eq(STREAM_ID), eq(parentStreamId), eq(weight), eq(true), eq(promise));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPromise in project netty by netty.
the class DefaultHttp2ConnectionEncoderTest method headersWithNoPriority.
@Test
public void headersWithNoPriority() {
writeAllFlowControlledFrames();
final int streamId = 6;
ChannelPromise promise = newPromise();
encoder.writeHeaders(ctx, streamId, EmptyHttp2Headers.INSTANCE, 0, false, promise);
verify(writer).writeHeaders(eq(ctx), eq(streamId), eq(EmptyHttp2Headers.INSTANCE), eq(0), eq(false), eq(promise));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPromise in project netty by netty.
the class DefaultHttp2ConnectionEncoderTest method settingsWriteAfterGoAwayShouldSucceed.
@Test
public void settingsWriteAfterGoAwayShouldSucceed() throws Exception {
goAwayReceived(0);
ChannelPromise promise = newPromise();
encoder.writeSettings(ctx, new Http2Settings(), promise);
verify(writer).writeSettings(eq(ctx), any(Http2Settings.class), eq(promise));
}
Aggregations