Refactoring HttpStreamAdapter