@Override
    public <T> T serialize(final Serializer<T> dict) {
        dict.setStringForKey(this.getType().name(), "Type");
        dict.setObjectForKey(host, "Host");
        if(destination != null) {
            dict.setObjectForKey(destination, "Destination");
        }
        dict.setListForKey(new ArrayList<Serializable>(selected.values()), "Destinations");
        dict.setListForKey(new ArrayList<Serializable>(selected.keySet()), "Roots");
        dict.setStringForKey(uuid, "UUID");
        dict.setStringForKey(String.valueOf(this.getSize()), "Size");
        dict.setStringForKey(String.valueOf(this.getTransferred()), "Current");
        if(timestamp != null) {
            dict.setStringForKey(String.valueOf(timestamp.getTime()), "Timestamp");
        }
        if(bandwidth != null) {
            dict.setStringForKey(String.valueOf(bandwidth.getRate()), "Bandwidth");
        }
        return dict.getSerialized();
    }
@Test
    public void testSerialize() {
        final Path test = new Path("t", EnumSet.of(Path.Type.file));
        CopyTransfer t = new CopyTransfer(new Host(new TestProtocol()),
                new Host(new TestProtocol()), Collections.singletonMap(test, new Path("d", EnumSet.of(Path.Type.file))));
        t.addSize(4L);
        t.addTransferred(3L);
        final Transfer serialized = new TransferDictionary<>(new ProtocolFactory(Collections.singleton(new TestProtocol()))).deserialize(t.serialize(SerializerFactory.get()));
        assertNotSame(t, serialized);
        assertEquals(t.roots, serialized.getRoots());
        assertEquals(t.getBandwidth(), serialized.getBandwidth());
        assertEquals(4L, serialized.getSize(), 0L);
        assertEquals(3L, serialized.getTransferred(), 0L);
    }