                     return
                 }
 
-                if let message = MQTTMessage(rawValue: messageBuffer.pointee & 0xf0) {
+                if let message = PacketType(rawValue: messageBuffer.pointee & 0xf0) {
                     messageType = message
                     messageParserState = .decodingLength
                     messageLengthMultiplier = 1

        }
    }

    // MARK: - MQTT messages

    /**


    private func readStream(input: InputStream, output: OutputStream) {
        var messageParserState: MQTTMessageParserState = .decodingHeader
        var messageType: PacketType = .connack

        var messageLengthMultiplier = 1
        var messageLength = 0
