It appears we must close the $writer when testing, otherwise we never get the response.

But when running for real (under Starman) the call to close() appears to hang
indefinitely if the connection has been lost.  That's why I had commented out
the call to close() before.