private static void blockUntilQueueFree(final FilterChainContext ctx) {
HttpContext httpContext = HttpContext.get(ctx);
final OutputSink outputSink = httpContext.getOutputSink();
if (!outputSink.canWrite()) {
final FutureImpl<Boolean> future = Futures.createSafeFuture();
outputSink.notifyCanWrite(new WriteHandler() {
@Override
public void onWritePossible() throws Exception {
future.result(TRUE);
}