Encode/decode test.