String password = config.password().get();
String authMech = config.authMechanism().get() == null
? "PLAIN"
: config.authMechanism().get();
ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();
builder.setProtocol( protocol );
if( username != null && !username.isEmpty() )
{
builder.setAuthDescriptor(
new AuthDescriptor(
new String[]
{
authMech
},
new PlainCallbackHandler( username, password )
)
);
}
client = new MemcachedClient( builder.build(), AddrUtil.getAddresses( addresses ) );
}
}