    @Test 
    public void testWrapperSerialization() throws IOException, ClassNotFoundException {

        D d = D.getInstance();
        byte[] buffer;
        try (ByteArrayOutputStream bout = new ByteArrayOutputStream();
                ObjectOutputStream oout = new ObjectOutputStream(bout)) {
            oout.writeObject(new DWrapper(d));
            oout.flush();
            buffer = bout.toByteArray();
        }
        D deserializedD;
        try (ByteArrayInputStream bin = new ByteArrayInputStream(buffer);
                ObjectInputStream oin = new ObjectInputStream(bin)) {
            deserializedD = ((DWrapper)oin.readObject()).getValue();
        }
        Assert.assertSame(d, deserializedD);
        Assert.assertSame(d, deserializedD.self);
    }