anchor.diff:        if (d == null) Expect.fail("Invalid data");
         sendData(d, server.port)
            .then((_) {
  -            if (!expectRequest) server.close();
  +            if (!expectRequest) requestCompleter.complete();
  +            requestCompleter.future.then((_) => server.close());
             });
   
         return c.future;
  
positive.code:             calledOnRequest = true;
              request.listen(
                  (_) {},
                  onError: (error) {
                    Expect.isFalse(calledOnError);
                    Expect.equals(exception, error.message);
                    calledOnError = true;
                    if (exception != null) port.close();
                  });
              server.close();
            },
            onDone: () {
              Expect.equals(expectRequest, calledOnRequest);
  
negative.code:         Expect.fail("No data response was expected");
        });
      socket.add(data);
      return socket.close()
          .then((_) {
            socket.destroy();
          });
    });
  }
  
  