socks5 tests

Some small changes were made to `socks5.c` to allow for easier testing and to avoid doing any IO during the unit tests. This seemed like the best option, as setting up a dummy server on a separate thread became too complex with the management of mutex locks and mutex conditions. So I've introduced some function pointers in `socks5.c` to allow for easier testing. Please keep in mind this is the initial approach I've come up with so feel free to make any suggestions or different approaches that you'd prefer to see.

`socks5_connect` is untested at this point as it makes a call to `tsocks_libc_connect` which should probably be tested as an integrated test at some stage.

In addition to the tests there are some minor bug fixes mainly for typos in `socks5.c`. These have been added as separate commits for clarity.