JmsUtils { public static void stopQuietly(Connection con) { if (con == null) return; try { con.stop(); } catch (Exception e) { } }  static JMSException wrapJMSException(Throwable e); static JMSException wrapJMSException(String msg, Throwable e); static void rethrowJMSException(Throwable e); static void rethrowJMSException(String msg, Throwable e); static void deleteQuietly(TemporaryQueue q); static void deleteQuietly(TemporaryTopic t); static void deleteTemporaryDestination(Destination d); static void closeQuietly(Connection con); static void closeQuietly(Connection con, boolean stopFirst); static void stopQuietly(Connection con); static void closeQuietly(Session session); static void closeQuietly(MessageProducer producer); static void closeQuietly(MessageConsumer consumer);  }
@Test public void testStopConnection() throws Exception { EmbeddedActiveMq broker = new EmbeddedActiveMq(); try { broker.start(); Connection connection = broker.createConnection(); JmsUtils.stopQuietly(connection); JmsUtils.stopQuietly(null); connection = broker.createConnection(); JmsUtils.stopQuietly(connection); connection = (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[] { Connection.class }, new FailingDynamicProxy()); JmsUtils.stopQuietly(connection); } finally { broker.destroy(); } }