Python 3 compat; Improve WSGI, WS, threading and tests

This includes:

* patching more tests to pass
* removing few unit tests which I think are redundant
* repeating SSL socket reads in a loop to read all data (I suspect this is
  related to the fact that writelines is used in the server code there and
  Python 3 writelines calls write/send repeatedly while on Python 2 it
  calls it once; on one hand there's no guarantee that single recv/read
  will return all data sent by the server, on the other hand it's quite
  suspicious that the number of required reads seems to be connected to
  the number of sends on the other side of the connection)
* working through Python 2/Python 3 threading and thread differences; the
  lock code I used is the simplest way I could make the tests pass but
  will likely need to be modified in order to match the original

This commit includes 6bcb1dc and closes GH #153