### Question:
JMSAccessorService implements Service { public ConnectionContext createConnectionContext(JMSConnectionInfo connInfo) { ConnectionContext connCtxt = connectionMap.get(connInfo); if (connCtxt == null) { try { connCtxt = getConnectionContextImpl(); connCtxt.createConnection(connInfo.getJNDIProperties()); connCtxt.setExceptionListener(new JMSExceptionListener(connInfo, connCtxt, true)); connectionMap.put(connInfo, connCtxt); LOG.info("Connection established to JMS Server for [{0}]", connInfo); } catch (Exception e) { LOG.warn("Exception while establishing connection to JMS Server for [{0}]", connInfo, e); return null; } } return connCtxt; }  @Override void init(Services services); void registerForNotification(JMSConnectionInfo connInfo, String topic, MessageHandler msgHandler); void unregisterFromNotification(JMSConnectionInfo connInfo, String topic); ConnectionContext createConnectionContext(JMSConnectionInfo connInfo); ConnectionContext createProducerConnectionContext(JMSConnectionInfo connInfo); @Override void destroy(); @Override Class<? extends Service> getInterface(); void reestablishConnection(JMSConnectionInfo connInfo); static final String CONF_PREFIX; static final String JMS_CONNECTION_CONTEXT_IMPL; static final String SESSION_OPTS; static final String CONF_RETRY_INITIAL_DELAY; static final String CONF_RETRY_MULTIPLIER; static final String CONF_RETRY_MAX_ATTEMPTS; }### Answer:
@Test public void testConnection() throws Exception { HCatAccessorService hcatService = services.get(HCatAccessorService.class); JMSAccessorService jmsService = services.get(JMSAccessorService.class); JMSConnectionInfo connInfo = hcatService.getJMSConnectionInfo(new URI("hcat: ConnectionContext ctxt1 = jmsService.createConnectionContext(connInfo); assertTrue(ctxt1.isConnectionInitialized()); JMSConnectionInfo connInfo1 = hcatService.getJMSConnectionInfo(new URI("http: ConnectionContext ctxt2 = jmsService.createConnectionContext(connInfo1); assertTrue(ctxt2.isConnectionInitialized()); assertEquals(ctxt1, ctxt2); ctxt1.close(); }