Fix buffer resizing bug

When a buffer gets resized and needs to drop data, the data is dropped,
but the maximal value of the buffer is never brought down. This patch
makes it so the function works as expected.

This fix also removes all the unused conversion functions that were used
in a past deploy.
Introduce ENV variable for tcp drain buffer size
Add tests for TCP drain resizing