decode requests, encode responses