mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/transport/TestTransportChannelImpl.java
@Test
    public void testTrySendMessageLoggingDisabled() throws IOException, CCommException
    {
        // Connection-less channel that is available
        activateChannel(false, true, null);

        //disable logging
        when(m_RemoteSettings.isLogRemoteMessagesEnabled()).thenReturn(false);
        
        // construct a single base namespace message to verify sent to socket
        TerraHarvestMessage message = TerraHarvestMessageHelper.createBaseMessage();
        
        // replay
        boolean sent = m_SUT.trySendMessage(message);
        assertThat(sent, is(true));
        
        // verify mock socket's output stream was asked to send message in binary form with delimiter at beginning
        byte[] binaryMessage = message.toByteArray();
        // first byte sent will be the varint (https://developers.google.com/protocol-buffers/docs/encoding#varints)
        // representing the length of the message following
        byte[] fullBinaryMessage = new byte[binaryMessage.length + 1]; // leave room for delimiter
        fullBinaryMessage[0] = (byte)binaryMessage.length;
        System.arraycopy(binaryMessage, 0, fullBinaryMessage, 1, binaryMessage.length);
        
        // should pass complete message as byte buffer to correct address
        verify(m_TransportLayer).send(ByteBuffer.wrap(fullBinaryMessage), m_Address);
        
        // verify logging is disabled
        verify(m_Logging, times(0)).debug(anyString());
    }
/**
     * Verify the message is sent using the given transport layer to the address in binary form, but no debug message 
     * is logged, because logging is disabled.
     */
Verify the message is sent using the given transport layer to the address in binary form, but no debug message
is logged, because logging is disabled.
Verify the message is sent using the given transport layer to the address in binary form but no debug message is logged because logging is disabled .
@Test
    public void testTrySendMessageLoggingDisabled() throws IOException, CCommException
    {
        activateChannel(false, true, null);
        when(m_RemoteSettings.isLogRemoteMessagesEnabled()).thenReturn(false);
        TerraHarvestMessage message = TerraHarvestMessageHelper.createBaseMessage();
        boolean sent = m_SUT.trySendMessage(message);
        assertThat(sent, is(true));
        byte[] binaryMessage = message.toByteArray();
        byte[] fullBinaryMessage = new byte[binaryMessage.length + 1]; 
        fullBinaryMessage[0] = (byte)binaryMessage.length;
        System.arraycopy(binaryMessage, 0, fullBinaryMessage, 1, binaryMessage.length);
        verify(m_TransportLayer).send(ByteBuffer.wrap(fullBinaryMessage), m_Address);
        verify(m_Logging, times(0)).debug(anyString());
    }
@ Test public void testTrySendMessageLoggingDisabled ( ) throws IOException , CCommException { activateChannel ( false , true , null ) ; when ( m_RemoteSettings . isLogRemoteMessagesEnabled ( ) ) . thenReturn ( false ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createBaseMessage ( ) ; boolean sent = m_SUT . trySendMessage ( message ) ; assertThat ( sent , is ( true ) ) ; byte [ ] binaryMessage = message . toByteArray ( ) ; byte [ ] fullBinaryMessage = new byte [ binaryMessage . length + 1 ] ; fullBinaryMessage [ 0 ] = ( byte ) binaryMessage . length ; System . arraycopy ( binaryMessage , 0 , fullBinaryMessage , 1 , binaryMessage . length ) ; verify ( m_TransportLayer ) . send ( ByteBuffer . wrap ( fullBinaryMessage ) , m_Address ) ; verify ( m_Logging , times ( 0 ) ) . debug ( anyString ( ) ) ; }
Verify the message is sent using the given transport layer to the address in binary form, but no debug message
 is logged, because logging is disabled.
Verify the message is sent using the given transport layer to the address in binary form but no debug message is logged because logging is disabled .
// Connection-less channel that is available //disable logging // construct a single base namespace message to verify sent to socket // replay // verify mock socket's output stream was asked to send message in binary form with delimiter at beginning // first byte sent will be the varint (https://developers.google.com/protocol-buffers/docs/encoding#varints) // representing the length of the message following // leave room for delimiter // should pass complete message as byte buffer to correct address // verify logging is disabled