Avoid writing to socket during connection callback.

Add process.nextTick to delay sendMessage calls.