}
public void openwireConnectTo(String connectorName, String username, String password) throws Exception {
URI brokerURI = broker.getConnectorByName(connectorName).getConnectUri();
String uri = "ssl://" + brokerURI.getHost() + ":" + brokerURI.getPort();
ActiveMQSslConnectionFactory cf = new ActiveMQSslConnectionFactory(uri);
cf.setTrustStore("org/apache/activemq/security" + sep + "broker1.ks");
cf.setTrustStorePassword("password");
cf.setKeyStore("org/apache/activemq/security" + sep + "client.ks");
cf.setKeyStorePassword("password");
ActiveMQConnection connection = null;
if (username != null || password != null) {
connection = (ActiveMQConnection)cf.createConnection(username, password);
} else {
connection = (ActiveMQConnection)cf.createConnection();
}
TestCase.assertNotNull(connection);
connection.start();
connection.stop();
}