Fix jshint warnings.
Fix terrible bug that led to incorrect cached data. Add tests.

The issue was causing the response bodies to be written out of order
when there were multiple connections open. This made the cache very
broken as soon as there was a concurrency > 1.

Now there's some basic tests for overall functionality as well as this
specific problem.
Adding travis setup.