'Set the callback to handle ALPN protocol choice.
:param callback: The callback function.  It will be invoked with two
arguments: the Connection, and a list of offered protocols as
bytestrings, e.g ``[b\'http/1.1\', b\'spdy/2\']``.  It should return
one of those bytestrings, the chosen protocol.'

@_requires_alpn
def set_alpn_select_callback(self, callback):

    self._alpn_select_helper = _ALPNSelectHelper(callback)
    self._alpn_select_callback = self._alpn_select_helper.callback
    _lib.SSL_CTX_set_alpn_select_cb(self._context, self._alpn_select_callback, _ffi.NULL)
