Fixed an issue where generated bytes was not stored in nonce

The generated byte were not stored in the nonce unless it was first
re-initialized as an empty array, this is due to the funny immutable/mutable
nuances of java.
Added unit tests for the Nonce, helped catch multiple issues