### Question:
IoSessionFactory { public IoSession getSession() { synchronized (lock) { if (sessions.isEmpty()) { return null; } else { final Object[] keys = sessions.keySet().toArray(); for (int i = 0; i < sessions.size(); i++) { counter++; final int pos = Math.abs(counter % sessions.size()); final IoSession session = sessions.get(keys[pos]); if (isAvailable(session)) { return session; } } return null; } } } 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 testGetSessionAlwaysReturnsConnectedSessions() throws Exception { for (int i = 0; i < 10; i++) { assertTrue(connectedSession.equals(sessionFactory.getSession())); } }