public <K, V> void testMap(Map<K, V> v, Class<K> keyElementClass, Class<V> valueElementClass) throws Exception {
MessagePack msgpack = new MessagePack();
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
if (v == null) {
packer.writeNil();
} else {
packer.writeMapBegin(v.size());
for (Map.Entry<K, V> e : ((Map<K, V>) v).entrySet()) {
packer.write(e.getKey());
packer.write(e.getValue());