For backward data compatibility, save many old messages in binary form and see if they can be deserialized with the new code.
For backward code compatibility, you will need some way of creating old code (for example, one version for each version) and testing related to data created from the latest version of the code. This is a slightly more complicated problem: you can create a small test jar in each respective release and at the same time include it in the source control to avoid having to create the same code again and again. Then your tests will try to use all the various jar files to output the new code.
Honestly, all this sounds pretty much for an experimental burst. For real work, I would just use protocol buffers :)
source share