Add a test for java serialization.

Also, make EMPTY a real singleton.