         } else {
             // self.logInfo("Authentication that can continue: %@", methods.componentsJoinedByString(", "))
         }
-        if !(methods as! [String]).contains(authMethod!) {
+        if !(methods as! [String]).contains(authMethod.rawValue) {
             XCTFail("No match authentication method found")
             expectation!.fulfill()
             return nil
         }
         
-        switch authMethod! {
-        case "password":
-            session.authenticateWithAskPassword({
-                () in
-                return self.password
-            })
-            break
-        case "publickey":
-            let publicKeyPath = NSBundle(forClass: self.dynamicType).pathForResource(identity, ofType: "");
+        switch authMethod {
+            case .Password:
+                session.authenticateWithAskPassword({
+                    () in
+                    return self.password
+                })
             
-            do {
-                let keyBase64 = try String(contentsOfFile: publicKeyPath!, encoding: NSUTF8StringEncoding)
-                let keyPair = try SSHKitKeyPair(fromBase64: keyBase64, withAskPass: nil)
-                session.authenticateWithKeyPair(keyPair)
-            } catch let error as NSError {
-                XCTFail(error.description)
-            }
-            
-        case "keyboard-interactive":
-            session.authenticateWithAskInteractiveInfo({
-                (index:Int, name:String!, instruction:String!, prompts:[AnyObject]!) -> [AnyObject]! in
-                return [self.password];
-                })
-            break
-        case "hostbased":
-            break
-        case "gssapi-with-mic":
-            break
-        default:
-            break
+            case .PublicKey:
+                let publicKeyPath = NSBundle(forClass: self.dynamicType).pathForResource(identity, ofType: "");
+                
+                do {
+                    let keyBase64 = try String(contentsOfFile: publicKeyPath!, encoding: NSUTF8StringEncoding)
+                    let keyPair = try SSHKitKeyPair(fromBase64: keyBase64, withAskPass: nil)
+                    session.authenticateWithKeyPair(keyPair)
+                } catch let error as NSError {
+                    XCTFail(error.description)
+                }
+                
+            case .Interactive:
+                session.authenticateWithAskInteractiveInfo({
+                    (index:Int, name:String!, instruction:String!, prompts:[AnyObject]!) -> [AnyObject]! in
+                    return [self.password];
+                    })
         }
         return nil
     }

    
    func connectSessionByPublicKeyBase64() -> SSHKitSession {
        expectation = expectationWithDescription("Connect Session By PublicKey Base64")
        authMethod = "publickey"
        let session = SSHKitSession(host: "127.0.0.1", port: 22, user: username, delegate: self)
        //session.connectToHost("127.0.0.1", onPort: 22, withUser: username)  // -f
        session.connectWithTimeout(1)

    
    func connectSessionByPassword() -> SSHKitSession {
        expectation = expectationWithDescription("Connect Session By Password")
        authMethod = .Password
        let session = SSHKitSession(host: "127.0.0.1", port: 22, user: username, delegate: self)
        //session.connectToHost("127.0.0.1", onPort: 22, withUser: username)  // -f
        session.connectWithTimeout(1)
