                     case .Asynchronously:
                         node0.sendMessage(messagePayload,
                                           success: { bytesSent in
-                                              self.asyncMessagesSent += 1
-                                              self.asyncBytesSent += UInt64(bytesSent)
+                                              doCatchWrapper(funcCall: {
+                                                                 try self.asyncSendMutex.lock {
+                                                                     self.asyncMessagesSent += 1
+                                                                     self.asyncBytesSent += UInt64(bytesSent)
+                                                                 }
+                                                             },
+                                                             failed:   { failure in
+                                                                 nanoMessageLogger(failure)
+                                                             })
                                           })
                         node1.receiveMessage(success: { received in
-                                                 self.asyncMessagesReceived += 1
-                                                 self.asyncBytesReceived += UInt64(received.bytes)
+                                                 doCatchWrapper(funcCall: {
+                                                                    try self.asyncReceiveMutex.lock {
+                                                                        self.asyncMessagesReceived += 1
+                                                                        self.asyncBytesReceived += UInt64(received.bytes)
+                                                                    }
+                                                                },
+                                                                failed:   { failure in
+                                                                    nanoMessageLogger(failure)
+                                                                })
                                              })
                 }
             }

        var completed = false

        asyncMessagesSent = 0
        asyncMessagesReceived = 0
        asyncBytesSent = 0
        asyncBytesReceived = 0

        do {

import Foundation
import C7
import Mutex
import ISFLibrary

@testable import NanoMessage

class MessageSpeedTests: XCTestCase {
    var asyncSendMutex: Mutex = try! Mutex()
    var asyncMessagesSent: UInt64 = 0
    var asyncBytesSent: UInt64 = 0
    var asyncReceiveMutex: Mutex = try! Mutex()
    var asyncMessagesReceived: UInt64 = 0
    var asyncBytesReceived: UInt64 = 0

    enum ReceiveType {
