Selection of SASL mechanism during SASL negotiation

Hi,

Just wondering how the selction of the SASL mechanism works?

For example if a Server A advertises to B


EXTERNAL


<mechanism>DIGEST-MD5</mechanism>
<mechanism>KERBEROS_V4</mechanism>

How does B decide which machanism to select(obviously it would have to be one it supports,
but in the case where more than 1 is supported what happens). Is there some priority
or is the first supported mechanism selected?
Is the selection controlable through some config files, how would it be controlled?


And I doubth my next q is possible at the mo, but might as well ask, can I specify for connecting to a server C I will only negotiate KERBEROS_V4 if it is offered but for B I may except DIGEST-MD5&EXTERNAL.

Thanks in advance.