@Test
void testOnDataRead_payloadTooLarge() {

  testHandler = new Http2Handler(mockEncoder, MAX_PAYLOAD, NO_CORS);
  // Create a fake request.
  XrpcRequest fakeRequest = new XrpcRequest((Http2Headers) null, null, null, channel);
  testHandler.requests.put(STREAM_ID, fakeRequest);
  // Start with a small payload, then add a bigger one.
  testHandler.onDataRead(mockContext, STREAM_ID, Unpooled.wrappedBuffer(new byte[10]), 0, false);
  verifyNoResponse();
  testHandler.onDataRead(
      mockContext, STREAM_ID, Unpooled.wrappedBuffer(new byte[MAX_PAYLOAD - 5]), 0, true);
  // Verify a TOO_MANY_REQUESTS response.
  assertEquals(0L, requestMeter.getCount());
  verifyResponse(
      HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE,
      ImmutableMap.of(),
      Optional.of(Unpooled.wrappedBuffer(XrpcConstants.PAYLOAD_EXCEEDED_RESPONSE)),
      STREAM_ID);
}