Class TestController

    • Method Detail

      • main

        public static void main​(String[] args)
                         throws IOException
        Parameters:
        args - String[]; command line arguments
        Throws:
        IOException - when communication fails
      • sendProtoMessage

        public static void sendProtoMessage​(OutputStream outputStream,
                                            AimsunControlProtoBuf.OTSMessage message)
                                     throws IOException
        Transit one message to the OTS server.
        Parameters:
        outputStream - OutputStream; output stream to the OTS server
        message - AimsunControlProtoBuf.OTSMessage; the message
        Throws:
        IOException - when communication fails in any way
      • receiveProtoMessage

        public static AimsunControlProtoBuf.OTSMessage receiveProtoMessage​(InputStream inputStream)
                                                                    throws IOException
        Read one OTSMessage.
        Parameters:
        inputStream - InputStream; input stream to read from
        Returns:
        OTSMessage; the OTSMessage that was constructed from the read bytes
        Throws:
        IOException - when communication fails
      • receiveBytes

        public static byte[] receiveBytes​(InputStream inputStream,
                                          int size)
                                   throws IOException
        Read a specified number of bytes.
        Parameters:
        inputStream - InputStream; input stream to read from
        size - int; number of bytes to read
        Returns:
        byte[]; byte array filled with the read bytes
        Throws:
        IOException - when communication fails