Refactoring to allow callers to more easily configure things like SSL handshake handlers