Allow socket reuse - tests open a large number of sockets and can cause
file descriptor exhaustion.

In the new scheme, recreate encoder and decoder each time the socket is
used. No artifacts from previous use should remain.