Scriptable globalScope = cx.initStandardObjects();
globalScope.put("myObject", globalScope, Context.javaToJS(new MyClass(), globalScope));
// deserialize
ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
ScriptableInputStream sis = new ScriptableInputStream(bais, globalScope);
globalScope = (Scriptable) sis.readObject();
Object continuation = sis.readObject();
sis.close();
bais.close();
Object result = cx.resumeContinuation(continuation, globalScope, 8);
assertEquals("foo", result);
} finally {