some additional features

* SOCKS4 support.
* SOCKS5 authentication support.
* configurable listen port.
* fix shutdown issue causing sockets to hang sometimes.

I meant to create independent pull requests for these commits, but I can't figure out how to do that in github...