4646
4747import com .rabbitmq .client .impl .AMQConnection ;
4848import com .rabbitmq .client .impl .FrameHandler ;
49- import com .rabbitmq .client .impl .PlainMechanism ;
49+ import com .rabbitmq .client .impl .PlainMechanismFactory ;
5050import com .rabbitmq .client .impl .SocketFrameHandler ;
5151
5252/**
@@ -87,8 +87,8 @@ public class ConnectionFactory implements Cloneable {
8787 public static final int DEFAULT_AMQP_OVER_SSL_PORT = 5671 ;
8888
8989 /** The default list of authentication mechanisms to use */
90- public static final AuthMechanism [] DEFAULT_AUTH_MECHANISMS =
91- new AuthMechanism [] { new PlainMechanism () };
90+ public static final AuthMechanismFactory [] DEFAULT_AUTH_MECHANISMS =
91+ new AuthMechanismFactory [] { new PlainMechanismFactory () };
9292
9393 /**
9494 * The default SSL protocol (currently "SSLv3").
@@ -103,9 +103,9 @@ public class ConnectionFactory implements Cloneable {
103103 private int requestedChannelMax = DEFAULT_CHANNEL_MAX ;
104104 private int requestedFrameMax = DEFAULT_FRAME_MAX ;
105105 private int requestedHeartbeat = DEFAULT_HEARTBEAT ;
106- private AuthMechanism [] authMechanisms = DEFAULT_AUTH_MECHANISMS ;
107106 private Map <String , Object > _clientProperties = AMQConnection .defaultClientProperties ();
108107 private SocketFactory factory = SocketFactory .getDefault ();
108+ private AuthMechanismFactory [] authMechanismFactories = DEFAULT_AUTH_MECHANISMS ;
109109
110110 /**
111111 * Instantiate a ConnectionFactory with a default set of parameters.
@@ -273,11 +273,11 @@ public void setClientProperties(Map<String, Object> clientProperties) {
273273 * @param serverMechanisms
274274 * @return
275275 */
276- public AuthMechanism getAuthMechanism (List <String > serverMechanisms ) {
276+ public AuthMechanismFactory getAuthMechanismFactory (List <String > serverMechanisms ) {
277277 // Our list is in order of preference, the server one is not.
278- for (AuthMechanism mechanism : authMechanisms ) {
279- if (serverMechanisms .contains (mechanism .getName ())) {
280- return mechanism ;
278+ for (AuthMechanismFactory f : authMechanismFactories ) {
279+ if (serverMechanisms .contains (f .getName ())) {
280+ return f ;
281281 }
282282 }
283283
@@ -286,11 +286,11 @@ public AuthMechanism getAuthMechanism(List<String> serverMechanisms) {
286286
287287 /**
288288 * Set authentication mechanisms to use (in descending preference order)
289- * @param mechanisms
289+ * @param factories
290290 * @see #DEFAULT_AUTH_MECHANISMS
291291 */
292- public void setAuthMechanisms ( AuthMechanism [] mechanisms ) {
293- this .authMechanisms = mechanisms ;
292+ public void setAuthMechanismFactories ( AuthMechanismFactory [] factories ) {
293+ this .authMechanismFactories = factories ;
294294 }
295295
296296 /**
0 commit comments