mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestRemoteChannelLookupImpl.java
@Test
    public void testCheckChannelSocketExists()
    {
        //Empty
        assertThat(m_SUT.checkChannelSocketExists("bob", 4000), is(false));
        
        //add a transport channel
        TransportChannel tChan = mock(TransportChannel.class);
        when(tChan.getLocalMessageAddress()).thenReturn("1111");
        when(tChan.getRemoteMessageAddress()).thenReturn("1111");
        when(tChan.getTransportLayerName()).thenReturn("name");
        
        m_SUT.syncChannel(tChan, 1);
        assertThat(m_SUT.checkChannelSocketExists("localhost", 12), is(false));
        assertThat(m_SUT.checkChannelSocketExists("localhost", 4000), is(false));
        
        //add a channel
        SocketChannel sChan = mockSocketChannel("localhost", 4000, false);
        
        m_SUT.syncChannel(sChan, 1);
        assertThat(m_SUT.checkChannelSocketExists("localhost", 12), is(false));
        assertThat(m_SUT.checkChannelSocketExists("bob", 4000), is(false));
        assertThat(m_SUT.checkChannelSocketExists("localhost", 4000), is(true));
    }
/**
     * Verify a proper socket duplicate can be found.
     */
Verify a proper socket duplicate can be found.
Verify a proper socket duplicate can be found .
@Test
    public void testCheckChannelSocketExists()
    {
        assertThat(m_SUT.checkChannelSocketExists("bob", 4000), is(false));
        TransportChannel tChan = mock(TransportChannel.class);
        when(tChan.getLocalMessageAddress()).thenReturn("1111");
        when(tChan.getRemoteMessageAddress()).thenReturn("1111");
        when(tChan.getTransportLayerName()).thenReturn("name");
        m_SUT.syncChannel(tChan, 1);
        assertThat(m_SUT.checkChannelSocketExists("localhost", 12), is(false));
        assertThat(m_SUT.checkChannelSocketExists("localhost", 4000), is(false));
        SocketChannel sChan = mockSocketChannel("localhost", 4000, false);
        m_SUT.syncChannel(sChan, 1);
        assertThat(m_SUT.checkChannelSocketExists("localhost", 12), is(false));
        assertThat(m_SUT.checkChannelSocketExists("bob", 4000), is(false));
        assertThat(m_SUT.checkChannelSocketExists("localhost", 4000), is(true));
    }
@ Test public void testCheckChannelSocketExists ( ) { assertThat ( m_SUT . checkChannelSocketExists ( "bob" , 4000 ) , is ( false ) ) ; TransportChannel tChan = mock ( TransportChannel . class ) ; when ( tChan . getLocalMessageAddress ( ) ) . thenReturn ( "1111" ) ; when ( tChan . getRemoteMessageAddress ( ) ) . thenReturn ( "1111" ) ; when ( tChan . getTransportLayerName ( ) ) . thenReturn ( "name" ) ; m_SUT . syncChannel ( tChan , 1 ) ; assertThat ( m_SUT . checkChannelSocketExists ( "localhost" , 12 ) , is ( false ) ) ; assertThat ( m_SUT . checkChannelSocketExists ( "localhost" , 4000 ) , is ( false ) ) ; SocketChannel sChan = mockSocketChannel ( "localhost" , 4000 , false ) ; m_SUT . syncChannel ( sChan , 1 ) ; assertThat ( m_SUT . checkChannelSocketExists ( "localhost" , 12 ) , is ( false ) ) ; assertThat ( m_SUT . checkChannelSocketExists ( "bob" , 4000 ) , is ( false ) ) ; assertThat ( m_SUT . checkChannelSocketExists ( "localhost" , 4000 ) , is ( true ) ) ; }
Verify a proper socket duplicate can be found.
Verify a proper socket duplicate can be found .
//Empty //add a transport channel //add a channel