Register ALPN callbacks only if protocols defined.
Catch more errors in callbacks, return after set return values.