allow setting server mode per-instance
better tests
test setting server mode on the stream instance, not the function
serialize and convert to stream