@Test
  public void testDefaultConstructor() throws Exception {
    ActiveMQConnectionFactory cf =
        ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF);
    assertFactoryParams(
        cf,
        null,
        null,
        null,
        ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
        ActiveMQClient.DEFAULT_CONNECTION_TTL,
        ActiveMQClient.DEFAULT_CALL_TIMEOUT,
        ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT,
        ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
        ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
        ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE,
        ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
        ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE,
        ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
        ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
        ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
        ActiveMQClient.DEFAULT_AUTO_GROUP,
        ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE,
        ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
        ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
        ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
        ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
        ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS,
        ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
        ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
        ActiveMQClient.DEFAULT_RETRY_INTERVAL,
        ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
        ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS);
    Connection conn = null;

    try {
      conn = cf.createConnection();

      conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      Assert.fail("Should throw exception");
    } catch (JMSException e) {
      // Ok
    }
    if (conn != null) {
      conn.close();
    }

    ActiveMQConnectionFactoryTest.log.info("Got here");

    testSettersThrowException(cf);
  }
  @Test
  public void testDiscoveryConstructor() throws Exception {
    DiscoveryGroupConfiguration groupConfiguration =
        new DiscoveryGroupConfiguration()
            .setBroadcastEndpointFactory(
                new UDPBroadcastEndpointFactory()
                    .setGroupAddress(groupAddress)
                    .setGroupPort(groupPort));
    ActiveMQConnectionFactory cf =
        ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
    assertFactoryParams(
        cf,
        null,
        groupConfiguration,
        null,
        ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
        ActiveMQClient.DEFAULT_CONNECTION_TTL,
        ActiveMQClient.DEFAULT_CALL_TIMEOUT,
        ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT,
        ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
        ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
        ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE,
        ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
        ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE,
        ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
        ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
        ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
        ActiveMQClient.DEFAULT_AUTO_GROUP,
        ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE,
        ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
        ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
        ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
        ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
        ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS,
        ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
        ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
        ActiveMQClient.DEFAULT_RETRY_INTERVAL,
        ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
        ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS);
    Connection conn = cf.createConnection();

    conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

    testSettersThrowException(cf);

    conn.close();
  }
  @Test
  public void testStaticConnectorLiveConstructor() throws Exception {
    ActiveMQConnectionFactory cf =
        ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, liveTC);
    assertFactoryParams(
        cf,
        new TransportConfiguration[] {liveTC},
        null,
        null,
        ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
        ActiveMQClient.DEFAULT_CONNECTION_TTL,
        ActiveMQClient.DEFAULT_CALL_TIMEOUT,
        ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT,
        ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
        ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
        ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE,
        ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
        ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE,
        ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
        ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
        ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
        ActiveMQClient.DEFAULT_AUTO_GROUP,
        ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE,
        ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
        ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
        ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
        ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
        ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS,
        ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
        ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
        ActiveMQClient.DEFAULT_RETRY_INTERVAL,
        ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
        ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS);
    Connection conn = cf.createConnection();

    conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

    testSettersThrowException(cf);

    cf.close();

    conn.close();
  }