EJBCLIENT-104: run tests with security manager and provide fixes

https://issues.jboss.org/browse/EJBCLIENT-104
Stuart already fixed the main issue. The PR contains a full set of fixes and tests.