Only use `hash_equals` if it exists.
Refactor Endpoint class for improved testability