Bug fixes and simplifications around auth middleware. Fix broken socket.io test. Add istanbul to gulpfile.