var helper = require("./test-helper.js"),
    Stream = require("..").WritableStream,
    fs = require("fs");

exports.dir = "Stream";

exports.test = function(test, cb) {
    var second = false,
        handler = helper.getEventCollector(function(err, events) {
            cb(err, events);
            if (!second) {
                second = true;
                handler.onreset();
                stream = new Stream(handler, test.options);
                stream.end(fs.readFileSync(__dirname + test.file));
            }
        }),
        stream = new Stream(handler, test.options);

    fs.createReadStream(__dirname + test.file).pipe(stream);
};

@@ -172,45 +172,88 @@
     
-var second = false,%0A        handler =
+fs.createReadStream(__dirname + test.file).pipe(%0A        new Stream(%0A           
  hel
@@ -310,16 +310,20 @@
         
+    
 cb(err, 
@@ -335,101 +335,71 @@
 s);%0A
-            if (!second) %7B%0A                second = true;%0A                handler.onreset();%0A
+%0A                var handler = helper.getEventCollector(cb),%0A  
     
@@ -402,32 +402,34 @@
                 
+  
 stream = new Str
@@ -456,16 +456,17 @@
 tions);%0A
+%0A
         
@@ -533,18 +533,8 @@
     
-        %7D%0A
     
@@ -553,36 +553,11 @@
     
-stream = new Stream(handler,
+   
  tes
@@ -569,70 +569,23 @@
 ions
-);%0A
 %0A    
-fs.createReadStream(__dirname + test.file).pipe(stream
+    )%0A    
 );%0A%7D

create a new handler for the second run