     }
 
     func connect() -> Bool {
-
         if inputStream != nil || outputStream != nil {
             return false
         }

        var username: String? = nil
        var password: String? = nil
        var clientId: String? = nil

        var concretePort: Int {
            return port ?? (useTLS ? 8883 : 1883)

        var messageLengthMultiplier = 1
        var messageLength = 0

        let messageBuffer = UnsafeMutablePointer<UInt8>.allocate(capacity: options.bufferSize)
        var byteCount = 0

        defer {
            messageBuffer.deinitialize(count: options.bufferSize)
            messageBuffer.deallocate(capacity: options.bufferSize)
        }

        while inputStream.streamStatus == .open {
