buffer: set error message on failure.
socket: ensure errno is cleared before socket call
mock-server: better logging.
tests: better logging.