let protocol take a function to determine protocol for each request.