anchor.diff:    after
       ex_fcgi:stop(fcgi),
       gen_tcp:close(LSocket) end.
  +
  +stream(_Config) ->
  +  Options = [binary, {active, false}, {reuseaddr, true}],
  +  {ok, LSocket} = gen_tcp:listen(33000, Options),
  +  {ok, _Pid} = ex_fcgi:start(fcgi, localhost, 33000),
  +  try
  +    Params = [{<<"P">>, <<"">>}],
  +    {ok, Ref} = ex_fcgi:begin_request(fcgi, responder, Params, 3000),
  +    {ok, Socket} = gen_tcp:accept(LSocket, 1000),
  +    try
  +      {ok, Data} = gen_tcp:recv(Socket, 35, 1000),
  +      <<% {begin_request, ReqId, responder, [keepalive]}
  +        1, ?FCGI_BEGIN_REQUEST, ReqId:16, 8:16, 0, _, ?FCGI_RESPONDER:16,
  +        ?FCGI_KEEP_CONN, _:40,
  +        % {params, ReqId, [<<"P">>, <<"">>]}
  +        1, ?FCGI_PARAMS, ReqId:16, 3:16, 0, _,
  +        0:1, 1:7, 0:1, 0:7, "P", "",
  +        % {params, ReqId, eof}
  +        1, ?FCGI_PARAMS, ReqId:16, 0:16, 0, _>> = Data,
  +      Reply1 = <<% {stdout, ReqId, <<"This is a boring test ">> ...
  +                 1, ?FCGI_STDOUT, ReqId:16, 31:16, 0, 0,
  +                 "This is a boring test ">>,
  +      ok = gen_tcp:send(Socket, Reply1),
  +      Reply2 = <<% ... <<"response.">>}
  +                 "response.",
  +                 % {end_request, ReqId + 1, request_complete, 1337}
  +                 1, ?FCGI_END_REQUEST, (ReqId + 1):16, 8:16, 0, 0,
  +                 1337:32, ?FCGI_REQUEST_COMPLETE, 0:24,
  +                 % {stdout, ReqId, eof}
  +                 1, ?FCGI_STDOUT, ReqId:16, 0:16, 0, 0,
  +                 % {end_request, ...
  +                 1, ?FCGI_END_REQUEST>>,
  +      ok = gen_tcp:send(Socket, Reply2),
  +      receive
  +        {ex_fcgi, Ref, Messages1} ->
  +          [{stdout, <<"This is a boring test response.">>},
  +           {stdout, eof}] = Messages1,
  +          Reply3 = <<% ... ReqId, ...
  +                     ReqId:16, 8:16, 0, 0>>,
  +          ok = gen_tcp:send(Socket, Reply3),
  +          Reply4 = <<% ... request_complete, 42}
  +                     42:32, ?FCGI_REQUEST_COMPLETE, 0:24>>,
  +          ok = gen_tcp:send(Socket, Reply4),
  +          receive
  +            {ex_fcgi, Ref, Messages2} ->
  +              [{end_request, request_complete, 42}] = Messages2;
  +            {ex_fcgi_timeout, Ref} ->
  +              exit(got_timeout_2)
  +          after 2000 ->
  +            exit(got_nothing_2) end;
  +        {ex_fcgi_timeout, Ref} ->
  +          exit(got_timeout_1)
  +      after 2000 ->
  +        exit(got_nothing_1) end
  +    after
  +      gen_tcp:close(Socket) end
  +  after
  +    ex_fcgi:stop(fcgi),
  +    gen_tcp:close(LSocket) end.
  
positive.code:          unknown_packet/1,
           abort_request/1,
           send/1,
           kill/1]).
  
  
  all() ->
    [big_param, simple_request, timeout, multiplex, unknown_packet,
     abort_request, send, kill].
  
  init_per_suite(Config) ->
    application:start(ex_fcgi),
  
negative.code:         % {abort_request, ReqId}
          1, ?FCGI_ABORT_REQUEST, ReqId:16, 0:16, 0, _>> = Data,
        receive
          {ex_fcgi, Ref, _Messages} ->
            exit(got_messages);
          {ex_fcgi_timeout, Ref} ->
            exit(got_timeout)
  