         super.viewDidLoad()
     }
 
-    func createClient() throws {
+    func createClient() throws -> TCPChannel {
         let address = try Address(address: "localhost", port: port)
-        clientChannel = TCPChannel(address: address)
+        let clientChannel = TCPChannel(address: address)
         clientChannel.configureSocket = {
             socket in
 

class TCPClientViewController: NSViewController {

    let port = UInt16(40000)
    var clientChannel: TCPChannel!
    var count: Int = 0

    dynamic var reconnect: Bool = false

    }

    @IBAction func disconnect(sender: AnyObject?) {
        guard let clientChannel = clientChannel else {
            fatalError()
        }

        clientChannel.disconnect() {
            (result) in
            SwiftIO.log?.debug("Client disconnect callback: \(result)")
