Replace pn_messenger_work based event handling with selectable based implementation in order to have more control. This greatly improves error handling and allows much cleaner tidying up of resources when errors occur

git-svn-id: https://svn.apache.org/repos/asf/qpid/proton/branches/fadams-javascript-binding@1631208 13f79535-47bb-0310-9956-ffa450edef68