@SuppressWarnings("unchecked")
Bean<SessScopedBean> bean = (Bean<SessScopedBean>) beans.iterator().next();
CreationalContext<SessScopedBean> ssbCreational = getBeanManager().createCreationalContext(bean);
Assert.assertNotNull(ssbCreational);
SessScopedBean reference = (SessScopedBean) getBeanManager().getReference(bean, SessScopedBean.class, ssbCreational);
Assert.assertNotNull(reference);
Assert.assertTrue(reference instanceof OwbNormalScopeProxy);
reference.getApp().setI(4711);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(reference);
byte[] ba = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(ba);
ObjectInputStream ois = new ObjectInputStream(bais);
SessScopedBean ssb2 = (SessScopedBean) ois.readObject();
Assert.assertNotNull(ssb2);
Assert.assertNotNull(ssb2.getApp());
Assert.assertTrue(ssb2.getApp().getI() == 4711);
}