Reorganized sendMessage()

I introduced a null pointer exception when sending empty messages with the blocking IO stuff, which evidently got fixed while I was eating dinner, but I still wanted to clean up the function a little.

Also I've hopefully fixed my indentation for this file and the settings in Eclipse to avoid more huge whitespace diffs.