// random node selection for fake load balancing
String currentNode = nodes[Stress.randomizer.nextInt(nodes.length)];
TSocket socket = new TSocket(currentNode, port);
TTransport transport = transportFactory.getTransport(socket);
CassandraClient client = new CassandraClient(new TBinaryProtocol(transport));
try
{
if (!transport.isOpen())
transport.open();
if (enable_cql)
client.set_cql_version(cqlVersion);
if (setKeyspace)
client.set_keyspace("Keyspace1");
if (username != null && password != null)
{
Map<String, String> credentials = new HashMap<String, String>();
credentials.put(IAuthenticator.USERNAME_KEY, username);
credentials.put(IAuthenticator.PASSWORD_KEY, password);
AuthenticationRequest authenticationRequest = new AuthenticationRequest(credentials);
client.login(authenticationRequest);
}
}
catch (AuthenticationException e)
{
throw new RuntimeException(e.getWhy());