wrap handler in NewEndpoint and remove SetHandler()