working echo server, client, and test

You can use contextlib.closing to perform the same pattern. That would let you write a block like:
```
with closing(socket.socket(...)) as s:
    pass
```

That would be the preferred method of handling a fragile resource, like the socket, that should be closed no matter what error occurs or does not occur in the code.