@Test public void testReportExceptionToContext() { ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext(); RuntimeException expected = new RuntimeException(); AtomicReference<Throwable> err = new AtomicReference<>(); ctx.exceptionHandler(err::set); ctx.reportException(expected); assertSame(expected, err.get()); } }
VertxHttp2Stream(C conn, Http2Stream stream, boolean writable) { this.conn = conn; this.vertx = conn.vertx(); this.handlerContext = conn.handlerContext; this.stream = stream; this.context = conn.getContext(); this.writable = writable; this.pending = new InboundBuffer<>(context, 5); this.priority = HttpUtils.DEFAULT_STREAM_PRIORITY; pending.drainHandler(v -> { int numBytes = pendingBytes; pendingBytes = 0; conn.handler.consume(stream, numBytes); }); pending.handler(this::handleData); pending.exceptionHandler(context.exceptionHandler()); pending.emptyHandler(v -> { if (trailers != null) { handleEnd(trailers); } }); pending.resume(); }
@Test public void testReportExceptionToContext() { ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext(); RuntimeException expected = new RuntimeException(); AtomicReference<Throwable> err = new AtomicReference<>(); ctx.exceptionHandler(err::set); ctx.reportException(expected); assertSame(expected, err.get()); } }
VertxHttp2Stream(C conn, Http2Stream stream, boolean writable) { this.conn = conn; this.vertx = conn.vertx(); this.handlerContext = conn.handlerContext; this.stream = stream; this.context = conn.getContext(); this.writable = writable; this.pending = new InboundBuffer<>(context, 5); this.priority = HttpUtils.DEFAULT_STREAM_PRIORITY; pending.drainHandler(v -> { int numBytes = pendingBytes; pendingBytes = 0; conn.handler.consume(stream, numBytes); }); pending.handler(this::handleData); pending.exceptionHandler(context.exceptionHandler()); pending.emptyHandler(v -> { if (trailers != null) { handleEnd(trailers); } }); pending.resume(); }