Resync with justinsb's repo + improvements to tests

Hi, I did these upgrades because I need some stable version to be uploaded to some Maven repo (central would be ideal). Could you please take these and do the upload? I'm building an Apache Camel (http://camel.apache.org/) component using it, but they surely won't accept the component as it's in SNAPSHOT stage. 

Thanks,
Alexandre