Added tests and fix for #22: segfault when operating on closed socket.
Now check to make sure socket is open.
Test cleanup. Move common code into init.
Lint cleanup.
Added tox, ported travis to use it.