Unit test project added

Handler tests added, some fixes made to stream flushing picked up by
tests