Fix trailing whitespaces

Fixes #1138
Merge pull request #1163 from authmillenon/fix-whitespaces

Fix trailing whitespaces
Implement packet buffer module
Add unittests for packet buffer