 
             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 {

            _ = try! socket.write(data)
        }
        write.resume()

        let group = DispatchGroup()
        group.enter()


        let read = DispatchSource.makeReadSource(fileDescriptor: socket.descriptor, queue: queue)

            _ = try! client.write(data)
        }

        try promise.future.blockingAwait(timeout: .seconds(3))
    }

    static let allTests = [
