         var messageLengthMultiplier = 1
         var messageLength = 0
 
-        let messageBuffer = UnsafeMutablePointer<UInt8>.allocate(capacity: LightMQTT.BUFFER_SIZE)
+        let messageBuffer = UnsafeMutablePointer<UInt8>.allocate(capacity: options.bufferSize)
         var byteCount = 0
 
         defer {
-            messageBuffer.deinitialize(count: LightMQTT.BUFFER_SIZE)
-            messageBuffer.deallocate(capacity: LightMQTT.BUFFER_SIZE)
+            messageBuffer.deinitialize(count: options.bufferSize)
+            messageBuffer.deallocate(capacity: options.bufferSize)
         }
 
         while inputStream.streamStatus == .open {

    }

    func connect() -> Bool {

        if inputStream != nil || outputStream != nil {
            return false
        }

        var username: String? = nil
        var password: String? = nil
        var clientId: String? = nil
        var bufferSize: Int = 4096

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