Improve stratum message handling

Prevent the case where multiple messages are chunked together without being processed (occasionally leading to the buffer growing too large and the client being kicked).

Recognize messages consisting only of spaces as malformed.