         XCTAssert(completed, "test not completed")
     }
 
-    func testTCPMessageSpeed() {
+    func testTCPMessageSpeedSerial() {
         print("TCP tests...")
-        testMessageSpeed(connectAddress: "tcp://localhost:5555", bindAddress: "tcp://*:5555")
+        testMessageSpeed(receiveType: .Serial, connectAddress: "tcp://localhost:5555", bindAddress: "tcp://*:5555")
     }
 
-    func testInProcessMessageSpeed() {
-        print("In-Process tests...")
-        testMessageSpeed(connectAddress: "inproc:///tmp/pipeline.inproc")
+    func testTCPMessageSpeedAsynchronously() {
+        print("TCP tests...")
+        testMessageSpeed(receiveType: .Asynchronously, connectAddress: "tcp://localhost:5555", bindAddress: "tcp://*:5555")
     }
 
-    func testInterProcessMessageSpeed() {
-        print("Inter Process tests...")
-        testMessageSpeed(connectAddress: "ipc:///tmp/pipeline.ipc")
+    func testInProcessMessageSpeedSerial() {
+        print("In-Process tests...")
+        testMessageSpeed(receiveType: .Serial, connectAddress: "inproc:///tmp/pipeline.inproc")
     }
 
-    func testWebSocketMessageSpeed() {
+    func testInProcessMessageSpeedAsynchronously() {
+        print("In-Process tests...")
+        testMessageSpeed(receiveType: .Asynchronously, connectAddress: "inproc:///tmp/pipeline.inproc")
+    }
+
+    func testInterProcessMessageSpeedSerial() {
+        print("Inter Process tests...")
+        testMessageSpeed(receiveType: .Serial, connectAddress: "ipc:///tmp/pipeline.ipc")
+    }
+
+    func testInterProcessMessageSpeedAsynchronously() {
+        print("Inter Process tests...")
+        testMessageSpeed(receiveType: .Asynchronously, connectAddress: "ipc:///tmp/pipeline.ipc")
+    }
+
+    func testWebSocketMessageSpeedSerial() {
         print("Web Socket tests...")
-        testMessageSpeed(connectAddress: "ws://localhost:5555", bindAddress: "ws://*:5555")
+        testMessageSpeed(receiveType: .Serial, connectAddress: "ws://localhost:5555", bindAddress: "ws://*:5555")
+    }
+
+    func testWebSocketMessageSpeedAsynchronously() {
+        print("Web Socket tests...")
+        testMessageSpeed(receiveType: .Asynchronously, connectAddress: "ws://localhost:5555", bindAddress: "ws://*:5555")
     }
 
 #if !os(OSX)
     static let allTests = [
-        ("testTCPMessageSpeed", testTCPMessageSpeed),
-        ("testInProcessMessageSpeed", testInProcessMessageSpeed),
-        ("testInterProcessMessageSpeed", testInterProcessMessageSpeed),
-        ("testWebSocketMessageSpeed", testWebSocketMessageSpeed)
+        ("testTCPMessageSpeedSerial", testTCPMessageSpeedSerial),
+        ("testTCPMessageSpeedAsynchronously", testTCPMessageSpeedAsynchronously),
+        ("testInProcessMessageSpeedSerial", testInProcessMessageSpeedSerial),
+        ("testInProcessMessageSpeedAsynchronously", testInProcessMessageSpeedAsynchronously),
+        ("testInterProcessMessageSpeedSerial", testInterProcessMessageSpeedSerial),
+        ("testInterProcessMessageSpeedAsynchronously", testInterProcessMessageSpeedAsynchronously),
+        ("testWebSocketMessageSpeedSerial", testWebSocketMessageSpeedSerial),
+        ("testWebSocketMessageSpeedAsynchronously", testWebSocketMessageSpeedAsynchronously)
     ]
 #endif
 }

@testable import NanoMessage

class MessageSpeedTests: XCTestCase {
    private func testMessageSpeed(connectAddress: String, bindAddress: String = "") {
        guard let connectURL = URL(string: connectAddress) else {
            XCTAssert(false, "connectURL is invalid")
            return


            for _ in 1 ... 100000 {
                let _ = try node0.sendMessage(messagePayload)

                switch (receiveType) {
                    case .Serial:
                        let _: ReceiveData = try node1.receiveMessage()
                    case .Asynchronously:
                        node1.receiveMessage({ (receive: ReceiveData?, error: Error?) -> Void in
                            if let error = error {
                                print(error)
                            }
                        })
                }
            }

            node1.aioGroup.wait()
