### Question:
IoSessionManager { public void shutdownSessions(Set<IoSession> ioSessions, CougarProtocol cougarProtocol, ExecutionVenueServerHandler handler) { shutdownSessions(ioSessions, cougarProtocol, handler, false); }  void shutdownSessions(Set<IoSession> ioSessions, CougarProtocol cougarProtocol, ExecutionVenueServerHandler handler); void shutdownSessions(Set<IoSession> ioSessions, CougarProtocol cougarProtocol, ExecutionVenueServerHandler handler, boolean blockUntilComplete); void setMaxTimeToWaitForRequestCompletion(long maxTimeToWaitForRequestCompletion); void setNioLogger(NioLogger nioLogger); void waitForOutstandingRequestsToComplete(final ExecutionVenueServerHandler handler);  }### Answer:
@Test public void testSuspendMessageIsNotWrittenForV1Sessions() { final IoSession ioSession = newSession(V1); sessionManager.shutdownSessions(singleton(ioSession), cougarProtocol, serverHandler); verify(ioSession, never()).write(isA(SuspendMessage.class)); verify(ioSession).write(isA(DisconnectMessage.class)); }
@Test public void testSuspendAndDisconnectMessagesAreWrittenForV2Sessions() { final IoSession ioSession = newSession(V2); sessionManager.shutdownSessions(singleton(ioSession), cougarProtocol, serverHandler); verify(ioSession).write(isA(SuspendMessage.class)); verify(ioSession).write(isA(DisconnectMessage.class)); }
@Test public void testSessionsAreClosedOnlyAfterOutstandingRequestsAreServed() { final IoSession ioSession = newSession(V2); ExecutionVenueServerHandler serverHandler = mock(ExecutionVenueServerHandler.class); when(serverHandler.getOutstandingRequests()).thenReturn(2l, 1l, 0l); sessionManager.shutdownSessions(singleton(ioSession), cougarProtocol, serverHandler); final InOrder inOrder = inOrder(ioSession, serverHandler); inOrder.verify(ioSession).write(isA(SuspendMessage.class)); inOrder.verify(serverHandler, times(3)).getOutstandingRequests(); inOrder.verify(ioSession).write(isA(DisconnectMessage.class)); }