mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/base/TestSocketChannel.java
@Test
    public void testMessage() throws IOException
    {
        try (Socket socket = SocketHostHelper.connectToController())
        {
            // send out message
            TerraHarvestMessage request = TerraHarvestMessageHelper.createRequestControllerInfoMsg();
            request.writeDelimitedTo(socket.getOutputStream());
            
            // read in response
            TerraHarvestMessage response = TerraHarvestMessage.parseDelimitedFrom(socket.getInputStream());
            TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
            assertThat(response, is(notNullValue()));
            assertThat(payLoadTest.getNamespace(), is(Namespace.Base));
    
            BaseNamespace namespaceResponse = BaseNamespace.parseFrom(payLoadTest.getNamespaceMessage());
            assertThat(namespaceResponse.getType(), is(BaseMessageType.ControllerInfo));
            
            ControllerInfoData systemInfo = ControllerInfoData.parseFrom(namespaceResponse.getData());
            assertThat(systemInfo.isInitialized(), is(true));
        }
    }
/**
     * Verify a simple message can be sent and a response is received.
     */
Verify a simple message can be sent and a response is received.
Verify a simple message can be sent and a response is received .
@Test
    public void testMessage() throws IOException
    {
        try (Socket socket = SocketHostHelper.connectToController())
        {
            TerraHarvestMessage request = TerraHarvestMessageHelper.createRequestControllerInfoMsg();
            request.writeDelimitedTo(socket.getOutputStream());
            TerraHarvestMessage response = TerraHarvestMessage.parseDelimitedFrom(socket.getInputStream());
            TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
            assertThat(response, is(notNullValue()));
            assertThat(payLoadTest.getNamespace(), is(Namespace.Base));
            BaseNamespace namespaceResponse = BaseNamespace.parseFrom(payLoadTest.getNamespaceMessage());
            assertThat(namespaceResponse.getType(), is(BaseMessageType.ControllerInfo));
            ControllerInfoData systemInfo = ControllerInfoData.parseFrom(namespaceResponse.getData());
            assertThat(systemInfo.isInitialized(), is(true));
        }
    }
@ Test public void testMessage ( ) throws IOException { try ( Socket socket = SocketHostHelper . connectToController ( ) ) { TerraHarvestMessage request = TerraHarvestMessageHelper . createRequestControllerInfoMsg ( ) ; request . writeDelimitedTo ( socket . getOutputStream ( ) ) ; TerraHarvestMessage response = TerraHarvestMessage . parseDelimitedFrom ( socket . getInputStream ( ) ) ; TerraHarvestPayload payLoadTest = TerraHarvestPayload . parseFrom ( response . getTerraHarvestPayload ( ) ) ; assertThat ( response , is ( notNullValue ( ) ) ) ; assertThat ( payLoadTest . getNamespace ( ) , is ( Namespace . Base ) ) ; BaseNamespace namespaceResponse = BaseNamespace . parseFrom ( payLoadTest . getNamespaceMessage ( ) ) ; assertThat ( namespaceResponse . getType ( ) , is ( BaseMessageType . ControllerInfo ) ) ; ControllerInfoData systemInfo = ControllerInfoData . parseFrom ( namespaceResponse . getData ( ) ) ; assertThat ( systemInfo . isInitialized ( ) , is ( true ) ) ; } }
Verify a simple message can be sent and a response is received.
Verify a simple message can be sent and a response is received .
// send out message // read in response