Fix for Joyent tests: BouncyCastle initialisation should happen a bit ea...

...rlier. Also some clean-up.