Skip to content

Commit

Permalink
Follow up for issue #10933 and associated PR #10949.
Browse files Browse the repository at this point in the history
Fixed HttpChannelTest.testOnFailure().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Dec 17, 2023
1 parent 62210d3 commit e481b45
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1220,17 +1220,16 @@ public boolean handle(Request request, Response response, Callback callback)
assertThat(chunk.getFailure(), sameInstance(failure));

CountDownLatch demand = new CountDownLatch(1);
// Demand callback not serialized until after onFailure listeners.
// Demand callback is serialized after the onFailure task runs.
rq.demand(demand::countDown);
assertThat(demand.getCount(), is(0L));
assertThat(demand.getCount(), is(1L));

FuturePromise<Throwable> callback = new FuturePromise<>();
// Write callback not serialized until after onFailure listeners.
handling.get().write(false, null, Callback.from(() ->
{}, callback::succeeded));
// Write callback not serialized until after the onFailure task runs.
handling.get().write(false, null, Callback.from(() -> {}, callback::succeeded));
assertTrue(callback.isDone());

// Process onFailure task.
// Run the onFailure task.
try (StacklessLogging ignore = new StacklessLogging(Response.class))
{
onFailure.run();
Expand Down

0 comments on commit e481b45

Please sign in to comment.