xstream.alias("software", Software.class);
ObjectOutputStream oos = xstream.createObjectOutputStream(writer);
oos.writeInt(123);
oos.writeObject("hello");
oos.writeObject(new Software("tw", "xs"));
oos.flush();
oos.close();
byte[] data = baos.toByteArray();
assertTrue("Too less data: " + data.length, data.length > 2);
ObjectInputStream ois = xstream.createObjectInputStream(new InputStreamReader(
new InflaterInputStream(new ByteArrayInputStream(data), new Inflater()), "UTF-8"));
assertEquals(123, ois.readInt());
assertEquals("hello", ois.readObject());
assertEquals(new Software("tw", "xs"), ois.readObject());
try {
ois.readObject(); // As far as I can see this is the only clue the
// ObjectInputStream gives that it's done.
fail("Expected EOFException");