src/main/java/de/javakaffee/kryoserializers/guava/ImmutableSortedMapSerializer.java
public static void registerSerializers(final Kryo kryo) {

        // we're writing a TreeMap, therefore we should register it
        kryo.register(java.util.TreeMap.class);

        final ImmutableSortedMapSerializer serializer = new ImmutableSortedMapSerializer();

        kryo.register(ImmutableSortedMap.class, serializer);
        kryo.register(ImmutableSortedMap.of().getClass(), serializer);

        final Comparable<Object> k1 = new Comparable<Object>() {
            @Override
            public int compareTo(Object o) {
                return o == this ? 0 : -1;
            }
        };
        final Comparable<Object> k2 = new Comparable<Object>() {
            @Override
            public int compareTo(Object o) {
                return o == this ? 0 : 1;
            }
        };
        final Object v1 = new Object();
        final Object v2 = new Object();

        kryo.register(ImmutableSortedMap.of(k1, v1).getClass(), serializer);
        kryo.register(ImmutableSortedMap.of(k1, v1, k2, v2).getClass(), serializer);

        Map<DummyEnum,Object> enumMap = new EnumMap<DummyEnum, Object>(DummyEnum.class);
        for (DummyEnum e : DummyEnum.values()) {
            enumMap.put(e, v1);
        }

        kryo.register(ImmutableSortedMap.copyOf(enumMap).getClass(), serializer);
    }
public static void registerSerializers(final Kryo kryo) {

        // we're writing a TreeMap, therefore we should register it
        kryo.register(java.util.TreeMap.class);

        final ImmutableSortedMapSerializer serializer = new ImmutableSortedMapSerializer();

        kryo.register(ImmutableSortedMap.class, serializer);
        kryo.register(ImmutableSortedMap.of().getClass(), serializer);

        final Comparable<Object> k1 = new Comparable<Object>() {
            @Override
            public int compareTo(Object o) {
                return o == this ? 0 : -1;
            }
        };
        final Comparable<Object> k2 = new Comparable<Object>() {
            @Override
            public int compareTo(Object o) {
                return o == this ? 0 : 1;
            }
        };
        final Object v1 = new Object();
        final Object v2 = new Object();

        kryo.register(ImmutableSortedMap.of(k1, v1).getClass(), serializer);
        kryo.register(ImmutableSortedMap.of(k1, v1, k2, v2).getClass(), serializer);

        Map<DummyEnum,Object> enumMap = new EnumMap<DummyEnum, Object>(DummyEnum.class);
        for (DummyEnum e : DummyEnum.values()) {
            enumMap.put(e, v1);
        }

        kryo.register(ImmutableSortedMap.copyOf(enumMap).getClass(), serializer);
    }
Creates a new {@link ImmutableSortedMapSerializer} and registers its serializer
for the several ImmutableMap related classes.

@param kryo the {@link Kryo} instance to set the serializer on