mil.dod.th.ose.time.service/test/mil/dod/th/ose/time/service/TestTimeChangeServiceThread.java
@Test
    public void testRunInputStreamException() throws IOException, InterruptedException
    {
        Socket client = mock(Socket.class);
        when(m_ServerSocket.accept()).thenReturn(client);
        
        doThrow(IOException.class).when(client).getInputStream();
        
        //kick off runner
        Thread thread = new Thread(m_SUT);
        thread.start();
        
        //give thread time to run
        verify(m_ServerSocket, timeout(1000).atLeast(2)).accept();
        verify(client, atLeast(1)).close();
        verify(m_SysTimeWrapper, never()).setSystemTime(Mockito.anyLong());
        
        m_SUT.stopRun();
        
        thread.join(5000);
    }
/**
     * Verify that an exception with opening a socket's input stream 
     * cause the code to go back to listen for a new client and closes 
     * the client connection.
     */
Verify that an exception with opening a socket's input stream
cause the code to go back to listen for a new client and closes
the client connection.
Verify that an exception with opening a socket ' s input stream cause the code to go back to listen for a new client and closes the client connection .
@Test
    public void testRunInputStreamException() throws IOException, InterruptedException
    {
        Socket client = mock(Socket.class);
        when(m_ServerSocket.accept()).thenReturn(client);
        doThrow(IOException.class).when(client).getInputStream();
        Thread thread = new Thread(m_SUT);
        thread.start();
        verify(m_ServerSocket, timeout(1000).atLeast(2)).accept();
        verify(client, atLeast(1)).close();
        verify(m_SysTimeWrapper, never()).setSystemTime(Mockito.anyLong());
        m_SUT.stopRun();
        thread.join(5000);
    }
@ Test public void testRunInputStreamException ( ) throws IOException , InterruptedException { Socket client = mock ( Socket . class ) ; when ( m_ServerSocket . accept ( ) ) . thenReturn ( client ) ; doThrow ( IOException . class ) . when ( client ) . getInputStream ( ) ; Thread thread = new Thread ( m_SUT ) ; thread . start ( ) ; verify ( m_ServerSocket , timeout ( 1000 ) . atLeast ( 2 ) ) . accept ( ) ; verify ( client , atLeast ( 1 ) ) . close ( ) ; verify ( m_SysTimeWrapper , never ( ) ) . setSystemTime ( Mockito . anyLong ( ) ) ; m_SUT . stopRun ( ) ; thread . join ( 5000 ) ; }
Verify that an exception with opening a socket's input stream
 cause the code to go back to listen for a new client and closes
 the client connection.
Verify that an exception with opening a socket ' s input stream cause the code to go back to listen for a new client and closes the client connection .
//kick off runner //give thread time to run