@Test public void testStop() throws JMSException { Connection connection = mock(Connection.class); Session session = mock(Session.class); transport.setConnection(connection); transport.setSession(session); transport.stop(); verify(connection, times(1)).stop(); verify(session, times(1)).close(); verifyNoMoreInteractions(connection, session); }
@Override public void stop() { if (session != null) { try { session.close(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms session", e); } finally { session = null; } } if (connection != null) { try { connection.stop(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms connection", e); } finally { connection = null; } } }
JmsTransport implements BrokerTransport { @Override public void stop() { if (session != null) { try { session.close(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms session", e); } finally { session = null; } } if (connection != null) { try { connection.stop(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms connection", e); } finally { connection = null; } } } }
JmsTransport implements BrokerTransport { @Override public void stop() { if (session != null) { try { session.close(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms session", e); } finally { session = null; } } if (connection != null) { try { connection.stop(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms connection", e); } finally { connection = null; } } }  }
JmsTransport implements BrokerTransport { @Override public void stop() { if (session != null) { try { session.close(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms session", e); } finally { session = null; } } if (connection != null) { try { connection.stop(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms connection", e); } finally { connection = null; } } }  @Override void init(String configPath); @Override void start(); @Override void stop(); @Override void send(Cdr msg); @Override void send(Cdr msg, String topicName); @Override boolean isLoggedOn(); @Override String getDefaultSessionId(); @Override void setTransportDelegate(TransportDelegate<String, Cdr> transDel); @Override @SuppressWarnings("unchecked") void setCodec(Codec c); @Override Codec getCodec(); @Override void setDelegate(ClientDelegate delegate); @Override ClientDelegate getDelegate(); @Override void subscribeToTopic(Optional<String> topicName, final Consumer<Cdr> cdrListener); @Override void subscribeToQueue(String queueName, Consumer<Cdr> cdrListener); @Override void sendToTopic(Cdr cdr, Optional<String> maybeTopicName); @Override void sendToQueue(Cdr cdr, String queueName); @Override void clearQueue(String queueName); @Override Cdr subscribeAndConsumeFromTopic(final Optional<String> topicName, final Duration timeout); @Override Cdr subscribeAndConsumeFromQueue(final String queueName, final Duration timeout); }
JmsTransport implements BrokerTransport { @Override public void stop() { if (session != null) { try { session.close(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms session", e); } finally { session = null; } } if (connection != null) { try { connection.stop(); } catch (JMSException e) { logger.error("Couldn't safely stop Jms connection", e); } finally { connection = null; } } }  @Override void init(String configPath); @Override void start(); @Override void stop(); @Override void send(Cdr msg); @Override void send(Cdr msg, String topicName); @Override boolean isLoggedOn(); @Override String getDefaultSessionId(); @Override void setTransportDelegate(TransportDelegate<String, Cdr> transDel); @Override @SuppressWarnings("unchecked") void setCodec(Codec c); @Override Codec getCodec(); @Override void setDelegate(ClientDelegate delegate); @Override ClientDelegate getDelegate(); @Override void subscribeToTopic(Optional<String> topicName, final Consumer<Cdr> cdrListener); @Override void subscribeToQueue(String queueName, Consumer<Cdr> cdrListener); @Override void sendToTopic(Cdr cdr, Optional<String> maybeTopicName); @Override void sendToQueue(Cdr cdr, String queueName); @Override void clearQueue(String queueName); @Override Cdr subscribeAndConsumeFromTopic(final Optional<String> topicName, final Duration timeout); @Override Cdr subscribeAndConsumeFromQueue(final String queueName, final Duration timeout);  }