moved packet handling into a separate method to allow testing
added tests for packetHandler() function
Merge pull request #39 from JamesCohen-awin/packet-handling-testing

Tests for packet handling