ValueFactory valueFactory = rootNode.getSession().getValueFactory();
rootNode.setProperty("bin", valueFactory.createBinary(instream));
rootNode.getSession().save();
ValueMap map = new JcrPropertyMap(rootNode);
instream = map.get("bin", InputStream.class);
assertNotNull(instream);
String read = IOUtils.toString(instream);
assertEquals("Stream read successfully", "this too shall pass", read);
instream = map.get("bin", InputStream.class);
assertNotNull(instream);
read = IOUtils.toString(instream);
assertEquals("Stream read successfully a second time", "this too shall pass", read);
}