### Question:
JmsPoolMessageConsumer implements MessageConsumer, AutoCloseable { @Override public void close() throws JMSException { if (closed.compareAndSet(false, true)) { session.onConsumerClose(messageConsumer); messageConsumer.close(); } } JmsPoolMessageConsumer(JmsPoolSession session, MessageConsumer messageConsumer); @Override void close(); @Override MessageListener getMessageListener(); @Override String getMessageSelector(); @Override Message receive(); @Override Message receive(long timeout); @Override Message receiveNoWait(); @Override void setMessageListener(MessageListener listener); @Override String toString(); MessageConsumer getMessageConsumer();  }### Answer:
@Test public void testCloseMoreThanOnce() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection(); Session session = connection.createSession(); Queue queue = session.createTemporaryQueue(); MessageConsumer consumer = session.createConsumer(queue); consumer.close(); consumer.close(); }