     var writeDataCount: Int = 0
     let writeDataMaxTimes = 100
     var totoalWroteDataLength: Int = -1
-    var totoalReadLength: Int = 0
+    
+    let dataWrote = NSMutableData()
+    let dataRead = NSMutableData()
 
     override func setUp() {
         super.setUp()
-        totoalReadLength = 0
         startEchoServer()
     }
     

            totoalWroteDataLength = (data?.length)! * writeDataMaxTimes
            for _ in 0..<writeDataMaxTimes {
                channel.writeData(data)
            }
            waitForExpectationsWithTimeout(5) { error in
                if let error = error {
                    print("Error: \(error.localizedDescription)")
                }
            }
        } catch let error as NSError {
            XCTFail(error.description)
        }

    }
    
    func channel(channel: SSHKitChannel, didReadStdoutData data: NSData) {
        dataRead.appendData(data)
        
        if writeDataCount == writeDataMaxTimes && dataRead.length == totoalWroteDataLength {
            writeExpectation!.fulfill()
        }
    }
