As noted by @oleg-nenashev in c0e42ff, toByteArray should be synchronized as well, just in case.
Merge branch 'master' of github.com:jenkinsci/remoting