mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/MessageDualListener.java
public void waitForMessages(int timeoutMS)
    {       
        m_Responses.clear();
        MessageThread messageThread = new MessageThread();
        try
        {
            Thread myThread = new Thread(messageThread);
            myThread.start();
            Thread.sleep(timeoutMS);
            messageThread.stop();
            myThread.join(SOCK_TIMEOUT+200); //give time for message thread to finish stopping
            assertThat(myThread.isAlive(), is(false));            
        }
        catch (InterruptedException e)
        {
            fail("Thread was interrupted while waiting for messages...\n" + e.getMessage());
        }
    }
/**
     * Method starts message listening thread and stops the thread after a specific amount of time. 
     * @param timeoutMS
     *      Maximum amount of time to wait (in milliseconds) for the listening thread to finish listening 
     *      for incoming messages.  The listening thread will be terminated in the event that execution
     *      cannot be completed in the allotted time.  
     */
Method starts message listening thread and stops the thread after a specific amount of time.
@param timeoutMS
Maximum amount of time to wait (in milliseconds) for the listening thread to finish listening
for incoming messages.  The listening thread will be terminated in the event that execution
cannot be completed in the allotted time.
Method starts message listening thread and stops the thread after a specific amount of time . @param timeoutMS Maximum amount of time to wait ( in milliseconds ) for the listening thread to finish listening for incoming messages . The listening thread will be terminated in the event that execution cannot be completed in the allotted time .
public void waitForMessages(int timeoutMS)
    {       
        m_Responses.clear();
        MessageThread messageThread = new MessageThread();
        try
        {
            Thread myThread = new Thread(messageThread);
            myThread.start();
            Thread.sleep(timeoutMS);
            messageThread.stop();
            myThread.join(SOCK_TIMEOUT+200); 
            assertThat(myThread.isAlive(), is(false));            
        }
        catch (InterruptedException e)
        {
            fail("Thread was interrupted while waiting for messages...\n" + e.getMessage());
        }
    }
public void waitForMessages ( int timeoutMS ) { m_Responses . clear ( ) ; MessageThread messageThread = new MessageThread ( ) ; try { Thread myThread = new Thread ( messageThread ) ; myThread . start ( ) ; Thread . sleep ( timeoutMS ) ; messageThread . stop ( ) ; myThread . join ( SOCK_TIMEOUT + 200 ) ; assertThat ( myThread . isAlive ( ) , is ( false ) ) ; } catch ( InterruptedException e ) { fail ( "Thread was interrupted while waiting for messages...\n" + e . getMessage ( ) ) ; } }
Method starts message listening thread and stops the thread after a specific amount of time.
Method starts message listening thread and stops the thread after a specific amount of time .
//give time for message thread to finish stopping