question: public byte [ ] serializeSessionData ( CustomRequestSession session , SessionSerializationMetadata metadata ) throws IOException { byte [ ] serialized = null ; try ( ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( new BufferedOutputStream ( bos ) ) ) { oos . writeObject ( metadata ) ; session . writeObjectData ( oos ) ; oos . flush ( ) ; serialized = bos . toByteArray ( ) ; } return serialized ; }
target:  method to serialize custom session data