Improve bufferedAmount test.

Check for an empty buffer before sending data.