Add support for passing in sockets

The docs specify that you can pass in a preexisting socket but
prior to this commit, that was not actually the case.