### Question:
IoSessionFactory { public void closeSession(SocketAddress endpoint, boolean reconnect) { synchronized (lock) { if (pendingConnections.containsKey(endpoint)) { final ReconnectTask task = pendingConnections.get(endpoint); if (task != null) { task.stop(); } } else { final IoSession ioSession = sessions.get(endpoint); if (ioSession != null) { close(ioSession, reconnect); } } } } 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 testCloseSession() throws Exception { final InetSocketAddress address1 = new InetSocketAddress("host1", 9003); final InetSocketAddress address2 = new InetSocketAddress("host2", 9003); sessionFactory.openSession(address1); sessionFactory.openSession(address2); sessionFactory.closeSession(connectedSession.getRemoteAddress(), false); sessionFactory.closeSession(address1, false); sessionFactory.closeSession(address2, false); verify(sessionFactory).close(connectedSession, false); }