### Question:
DefaultConnectionContext implements ConnectionContext { @Override public Session createThreadLocalSession(final int sessionOpts) throws JMSException { Session session = th.get(); if (session != null) { return session; } th.remove(); session = createSession(sessionOpts); th.set(session); return session; }  @Override void createConnection(Properties props); @Override boolean isConnectionInitialized(); @Override void setExceptionListener(ExceptionListener exceptionListener); @Override Session createSession(int sessionOpts); @Override MessageConsumer createConsumer(Session session, String topicName); @Override MessageProducer createProducer(Session session, String topicName); @Override void close(); @Override Session createThreadLocalSession(final int sessionOpts); @Override MessageConsumer createConsumer(Session session, String topicName, String selector);  }### Answer:
@Test public void testThreadLocalSession() throws JMSException { String jmsProps = services.getConf().get(JMSJobEventListener.JMS_CONNECTION_PROPERTIES); JMSConnectionInfo connInfo = new JMSConnectionInfo(jmsProps); ConnectionContext jmsContext = Services.get().get(JMSAccessorService.class) .createConnectionContext(connInfo); Thread th = new Thread(new SessionThread(jmsContext)); th.start(); try { th.join(); } catch (InterruptedException e) { e.printStackTrace(); } assertEquals(session1, session2); Session session3 = jmsContext.createThreadLocalSession(Session.AUTO_ACKNOWLEDGE); Session session4 = jmsContext.createThreadLocalSession(Session.AUTO_ACKNOWLEDGE); assertTrue(session3.equals(session4)); assertFalse(session1.equals(session3)); }