mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestServerSocketMessageListener.java
@Test
    public void testActivate() throws IOException, InterruptedException
    {
        BundleContext contextNoProp = mock(BundleContext.class);
        
        m_SUT.activate(contextNoProp);
        
        // verify server socket created for the correct port
        verify(m_Factory).createServerSocket(ServerSocketMessageListener.DEFAULT_PORT, false);
        
        // wait long enough to accept 2 sockets, verify at least that many have been accepted
        Thread.sleep(1500);
        verify(m_ServerSocket, atLeast(2)).accept();
        
        // verify a remote channel has been created for each accepted socket
        verify(m_RemoteChannelLookup, atLeast(2)).newServerSocketChannel(Mockito.any(Socket.class));
        
        // need to force thread to stop
        m_SUT.deactivate();
    }
/**
     * Verify the socket server starts up and accepts multiple connections.  For each accepted connection, verify a 
     * remote socket channel is created.
     */
Verify the socket server starts up and accepts multiple connections.  For each accepted connection, verify a
remote socket channel is created.
Verify the socket server starts up and accepts multiple connections . For each accepted connection verify a remote socket channel is created .
@Test
    public void testActivate() throws IOException, InterruptedException
    {
        BundleContext contextNoProp = mock(BundleContext.class);
        m_SUT.activate(contextNoProp);
        verify(m_Factory).createServerSocket(ServerSocketMessageListener.DEFAULT_PORT, false);
        Thread.sleep(1500);
        verify(m_ServerSocket, atLeast(2)).accept();
        verify(m_RemoteChannelLookup, atLeast(2)).newServerSocketChannel(Mockito.any(Socket.class));
        m_SUT.deactivate();
    }
@ Test public void testActivate ( ) throws IOException , InterruptedException { BundleContext contextNoProp = mock ( BundleContext . class ) ; m_SUT . activate ( contextNoProp ) ; verify ( m_Factory ) . createServerSocket ( ServerSocketMessageListener . DEFAULT_PORT , false ) ; Thread . sleep ( 1500 ) ; verify ( m_ServerSocket , atLeast ( 2 ) ) . accept ( ) ; verify ( m_RemoteChannelLookup , atLeast ( 2 ) ) . newServerSocketChannel ( Mockito . any ( Socket . class ) ) ; m_SUT . deactivate ( ) ; }
Verify the socket server starts up and accepts multiple connections.
Verify the socket server starts up and accepts multiple connections .
// verify server socket created for the correct port // wait long enough to accept 2 sockets, verify at least that many have been accepted // verify a remote channel has been created for each accepted socket // need to force thread to stop