Two error handling fixes and a new extension point

Hi, two small fixes for you. The last one fixes reconnecting if the connection is interrupted, which previously resulted in a NullPointerException. I also added an extension point that lets plugins work directly with the connection, which I am using to declare and use custom queues.