Cast HTTP connection to interface rather than implementation class