 
             let string = String(data: response, encoding: .utf8)
             XCTAssert(string?.contains("HTTP/1.0 400 Bad Request") == true)
-            group.leave()
+            promise.complete(())
         }
         read.resume()
 
         XCTAssertNotNil([read, write])
-        group.wait()
+        try promise.future.blockingAwait(timeout: .seconds(3))
     }
 
     func testBind() throws {

import Dispatch
import TCP
import XCTest

            read.setEventHandler {
                let data = try! client.read(max: 8_192)
                XCTAssertEqual(String(data: data, encoding: .utf8), "hello")
                promise.complete(())
            }
            read.resume()
            
