@Test
  public void testConnectionGetConfiguredURIApplied() throws Exception {
    URI mock = new URI("mock://localhost");

    JmsConnectionFactory factory = new JmsConnectionFactory(mock);

    JmsConnection connection = (JmsConnection) factory.createConnection();
    assertEquals(mock, connection.getConfiguredURI());
    connection.start();
    assertEquals(mock, connection.getConnectedURI());
  }
  @Test
  public void testConnectionFactoryOptionsAreAppliedToConnection() throws JMSException {
    JmsConnectionFactory factory = new JmsConnectionFactory(USER, PASSWORD, "mock://localhost");

    factory.setTopicPrefix(TOPIC_PREFIX_PROP);
    factory.setQueuePrefix(QUEUE_PREFIX_PROP);
    factory.setClientID(CLIENT_ID_PROP);

    factory.setForceSyncSend(!factory.isForceSyncSend());
    factory.setForceAsyncSend(!factory.isForceAsyncSend());
    factory.setLocalMessagePriority(!factory.isLocalMessagePriority());
    factory.setForceAsyncAcks(!factory.isForceAsyncAcks());
    factory.setConnectTimeout(TimeUnit.SECONDS.toMillis(30));
    factory.setCloseTimeout(TimeUnit.SECONDS.toMillis(45));

    factory.getPrefetchPolicy().setAll(1);

    JmsConnection connection = (JmsConnection) factory.createConnection();
    assertNotNull(connection);

    assertEquals(USER, connection.getUsername());
    assertEquals(PASSWORD, connection.getPassword());
    assertEquals(CLIENT_ID_PROP, connection.getClientID());
    assertEquals(TOPIC_PREFIX_PROP, connection.getTopicPrefix());
    assertEquals(QUEUE_PREFIX_PROP, connection.getQueuePrefix());

    assertEquals(factory.isForceSyncSend(), connection.isForceSyncSend());
    assertEquals(factory.isForceAsyncSend(), connection.isForceAsyncSend());
    assertEquals(factory.isLocalMessagePriority(), connection.isLocalMessagePriority());
    assertEquals(factory.isForceAsyncAcks(), connection.isForceAsyncAcks());

    assertEquals(TimeUnit.SECONDS.toMillis(30), connection.getConnectTimeout());
    assertEquals(TimeUnit.SECONDS.toMillis(45), connection.getCloseTimeout());

    assertEquals(1, connection.getPrefetchPolicy().getTopicPrefetch());
    assertEquals(1, connection.getPrefetchPolicy().getQueuePrefetch());
    assertEquals(1, connection.getPrefetchPolicy().getQueueBrowserPrefetch());
    assertEquals(1, connection.getPrefetchPolicy().getDurableTopicPrefetch());
  }