added a test to only send message when connected