private int getConnectionCount(EmbeddedJMS server) throws Exception {
   ManagementService managementService = server.getActiveMQServer().getManagementService();
   ActiveMQServerControl jmsControl =
       (ActiveMQServerControl) managementService.getResource(ResourceNames.BROKER);
   String[] ids = jmsControl.listConnectionIDs();
   if (ids != null) {
     return ids.length;
   }
   return 0;
 }
 @Override
 public void dropAllSubscriptions() throws Exception {
   ActiveMQServerControl serverControl =
       (ActiveMQServerControl) managementService.getResource(ResourceNames.CORE_SERVER);
   String[] queues = addressControl.getQueueNames();
   for (String queue : queues) {
     // Drop all subscription shouldn't delete the dummy queue used to identify if the topic exists
     // on the core queues.
     // we will just ignore this queue
     if (!queue.equals(managedTopic.getAddress())) {
       serverControl.destroyQueue(queue);
     }
   }
 }
 @Override
 public void dropDurableSubscription(final String clientID, final String subscriptionName)
     throws Exception {
   String queueName =
       ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, subscriptionName);
   QueueControl coreQueueControl =
       (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queueName);
   if (coreQueueControl == null) {
     throw new IllegalArgumentException(
         "No subscriptions with name " + queueName + " for clientID " + clientID);
   }
   ActiveMQServerControl serverControl =
       (ActiveMQServerControl) managementService.getResource(ResourceNames.CORE_SERVER);
   serverControl.destroyQueue(queueName);
 }