bugfix null reference in httpclient, refactor from inheritance to double dispatch pattern