faraday
faraday copied to clipboard
[drain] would loop infinitely if no bytes were currently pending.
This PR fixes this and adds some tests for the [drain] function.
It might be better just rename this close_and_drain
and perform the close at the top of the function.