         return remainingBytes
     }
 
+    private func encodeUTF8Length(_ string:String) -> [UInt8] {
+        return [UInt16(string.utf8.count).highByte, UInt16(string.utf8.count).lowByte]
+
+    }
+
 }

         * |----------------------------------------------------------------------------------
         */

        let connectBytes: [UInt8] = [
            0x10,                               // FIXED BYTE 1   1 = CONNECT, 0 = DUP QoS RETAIN, not used in CONNECT
            UInt8(client.utf8.count + 12),      // FIXED BYTE 2   remaining length, client id length + 12
            0x00,                               // VARIA BYTE 1   length MSB
            0x04,                               // VARIA BYTE 2   length LSB is 4
            0x4d,                               // VARIA BYTE 3   M


    private var pingInterval: UInt16 = 10
    private var useTLS = false
    private var username:String?
    private var password:String?

    private var inputStream: InputStream?
    private var outputStream: OutputStream?
