Add tests for Hybi and Client handlers and fix some minor bugs.