use of io.netty.handler.codec.http2.Http2TestUtil.TestStreamByteDistributorStreamState in project netty by netty.
the class AbstractWeightedFairQueueByteDistributorDependencyTest method initState.
void initState(final int streamId, final long pendingBytes, final boolean hasFrame, final boolean isWriteAllowed) {
final Http2Stream stream = stream(streamId);
TestStreamByteDistributorStreamState state = new TestStreamByteDistributorStreamState(stream, pendingBytes, hasFrame, isWriteAllowed);
stateMap.put(streamId, state);
distributor.updateStreamableBytes(state);
}
use of io.netty.handler.codec.http2.Http2TestUtil.TestStreamByteDistributorStreamState in project netty by netty.
the class AbstractWeightedFairQueueByteDistributorDependencyTest method writeAnswer.
Answer<Void> writeAnswer(final boolean closeIfNoFrame) {
return new Answer<Void>() {
@Override
public Void answer(InvocationOnMock in) throws Throwable {
Http2Stream stream = in.getArgument(0);
int numBytes = in.getArgument(1);
TestStreamByteDistributorStreamState state = stateMap.get(stream.id());
state.pendingBytes -= numBytes;
state.hasFrame = state.pendingBytes > 0;
state.isWriteAllowed = state.hasFrame;
if (closeIfNoFrame && !state.hasFrame) {
stream.close();
}
distributor.updateStreamableBytes(state);
return null;
}
};
}
use of io.netty.handler.codec.http2.Http2TestUtil.TestStreamByteDistributorStreamState in project netty by netty.
the class UniformStreamByteDistributorTest method initState.
private void initState(final int streamId, final long pendingBytes, final boolean hasFrame, final boolean isWriteAllowed) {
final Http2Stream stream = stream(streamId);
TestStreamByteDistributorStreamState state = new TestStreamByteDistributorStreamState(stream, pendingBytes, hasFrame, isWriteAllowed);
stateMap.put(streamId, state);
distributor.updateStreamableBytes(state);
}
use of io.netty.handler.codec.http2.Http2TestUtil.TestStreamByteDistributorStreamState in project netty by netty.
the class UniformStreamByteDistributorTest method writeAnswer.
private Answer<Void> writeAnswer() {
return new Answer<Void>() {
@Override
public Void answer(InvocationOnMock in) throws Throwable {
Http2Stream stream = in.getArgument(0);
int numBytes = in.getArgument(1);
TestStreamByteDistributorStreamState state = stateMap.get(stream.id());
state.pendingBytes -= numBytes;
state.hasFrame = state.pendingBytes > 0;
distributor.updateStreamableBytes(state);
return null;
}
};
}
Aggregations