### Question:
IoSessionFactory { public void openSession(SocketAddress endpoint) { synchronized (lock) { if (!pendingConnections.containsKey(endpoint)) { final ReconnectTask task = new ReconnectTask(endpoint); pendingConnections.put(endpoint, task); this.reconnectExecutor.submit(task); } } } IoSessionFactory(NioLogger logger,
                            String hosts,
                            JMXReportingThreadPoolExecutor executorService,
                            JMXReportingThreadPoolExecutor reconnectExecutor,
                            NioConfig config,
                            IoHandler ioHandler,
                            IoFutureListener sessionClosedListener,
                            int reconnectInterval,
                            int handshakeResponseTimeout,
                            long sessionRecycleInterval,
                            NetworkAddressResolver addressResolver); boolean isConnected(); Set<SocketAddress> getCurrentSessionAddresses(); Map<String, String> getConnectedStatus(); void start(); void stop(); IoSession getSession(); void openSession(SocketAddress endpoint); void closeSession(SocketAddress endpoint, boolean reconnect); void close(final IoSession aSession); void close(final IoSession aSession, boolean reconnect); IoSession connect(final SocketAddress endpoint); @ManagedAttribute int getReconnectInterval(); @ManagedAttribute String getHosts();  }### Answer:
@Test public void testOpenSession() throws Exception { final InetSocketAddress address1 = new InetSocketAddress("host1", 9003); final InetSocketAddress address2 = new InetSocketAddress("host2", 9003); sessionFactory.openSession(address1); sessionFactory.openSession(address2); Field pendingConnections = IoSessionFactory.class.getDeclaredField("pendingConnections"); pendingConnections.setAccessible(true); Map<SocketAddress, Object> map = (Map<SocketAddress, Object>) pendingConnections.get(sessionFactory); assertEquals(2, map.size()); assertTrue(map.keySet().contains(address1)); assertTrue(map.keySet().contains(address2)); sessionFactory.openSession(address1); sessionFactory.openSession(address2); map = (Map<SocketAddress, Object>) pendingConnections.get(sessionFactory); assertEquals(2, map.size()); assertTrue(map.keySet().contains(address1)); assertTrue(map.keySet().contains(address2)); }