mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestServerSocketMessageListener.java
@Test
    public void testDeactivate() throws IOException, InterruptedException
    {
        BundleContext contextNoProp = mock(BundleContext.class);
        
        m_SUT.activate(contextNoProp);
        
        // wait long enough to accept 2 sockets
        Thread.sleep(1500);
        
        m_SUT.deactivate();
        
        // verify server socket stops listening
        verify(m_ServerSocket).close();
        
        // verify thread is no longer running, since accept is not longer being called
        // should be equal to the number of successful calls + the last failure
        int expectedCalls = m_Sockets.size() + 1;
        verify(m_ServerSocket, times(expectedCalls)).accept();
    }
/**
     * Verify socket stops listening on port and all child threads are stopped.
     */
Verify socket stops listening on port and all child threads are stopped.
Verify socket stops listening on port and all child threads are stopped .
@Test
    public void testDeactivate() throws IOException, InterruptedException
    {
        BundleContext contextNoProp = mock(BundleContext.class);
        m_SUT.activate(contextNoProp);
        Thread.sleep(1500);
        m_SUT.deactivate();
        verify(m_ServerSocket).close();
        int expectedCalls = m_Sockets.size() + 1;
        verify(m_ServerSocket, times(expectedCalls)).accept();
    }
@ Test public void testDeactivate ( ) throws IOException , InterruptedException { BundleContext contextNoProp = mock ( BundleContext . class ) ; m_SUT . activate ( contextNoProp ) ; Thread . sleep ( 1500 ) ; m_SUT . deactivate ( ) ; verify ( m_ServerSocket ) . close ( ) ; int expectedCalls = m_Sockets . size ( ) + 1 ; verify ( m_ServerSocket , times ( expectedCalls ) ) . accept ( ) ; }
Verify socket stops listening on port and all child threads are stopped.
Verify socket stops listening on port and all child threads are stopped .
// wait long enough to accept 2 sockets // verify server socket stops listening // verify thread is no longer running, since accept is not longer being called // should be equal to the number of successful calls + the last failure