         return socketFD
     }
     public let channel: dispatch_io_t
-    
     public var eventEmitter: IOStreamEventEmitter = IOStreamEventEmitter()
-    
-    private let connectingSource: dispatch_source_t
     
     public convenience init(loop: RunLoop) {
         self.init(loop: loop, fd: SocketFileDescriptor(socketType: SocketType.stream, addressFamily: AddressFamily.inet))

        // Non-blocking, dispatch connection, check errno for connection error.
        let error = Error(rawValue: errno)
        if case Error.inProgress = error {
            
            dispatch_io_write(channel, off_t(), dispatch_data_empty, dispatch_get_main_queue()) { done, data, error in
                log.debug("Writing to see if open, done: \(done), data: \(data), error: \(Error(rawValue: error))")
            }
            
            // Wait for source to be writable. Then we are connected.
            dispatch_source_set_event_handler(connectingSource) { [connectingSource = self.connectingSource] in
                log.debug("Writing hap")
                var result = 0
                var resultLength = socklen_t(strideof(result.dynamicType))
                let ret = getsockopt(self.fd.rawValue, SOL_SOCKET, SO_ERROR, &result, &resultLength)

                if result != 0 {
                    try! { throw Error(rawValue: Int32(result)) }()
                }
                log.debug("Connection established on \(self.fd)")
                onConnect()
            }
        } else {
            throw error
        }
    }
    
    func close () {
        dispatch_io_close(channel, 0)
    }
}