Single socket write call in write method.

And return the result of the underlying write.
Extract command writer into separate export.
Extract test helper function.
Add writer test.
Add failing write tests.
Bufferify writeCommand, fixes failing write tests.