Add a test for HTTP server chunk length being correct when using an encoding to write a reply.

Fixes issue #5777