Fix test to use send() instead of sendall()

Whoops, I called the wrong function.
Add tests to ensure socket gets closed