Package org.opentrafficsim.demo
Class TestController
- java.lang.Object
-
- org.opentrafficsim.demo.TestController
-
public final class TestController extends java.lang.Object
Test client for AimsunController.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version Apr 18, 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
static byte[]
receiveBytes(java.io.InputStream inputStream, int size)
Read a specified number of bytes.static AimsunControlProtoBuf.OTSMessage
receiveProtoMessage(java.io.InputStream inputStream)
Read one OTSMessage.static void
sendProtoMessage(java.io.OutputStream outputStream, AimsunControlProtoBuf.OTSMessage message)
Transit one message to the OTS server.
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.io.IOException
- Parameters:
args
- String[]; command line arguments- Throws:
java.io.IOException
- when communication fails
-
sendProtoMessage
public static void sendProtoMessage(java.io.OutputStream outputStream, AimsunControlProtoBuf.OTSMessage message) throws java.io.IOException
Transit one message to the OTS server.- Parameters:
outputStream
- OutputStream; output stream to the OTS servermessage
- AimsunControlProtoBuf.OTSMessage; the message- Throws:
java.io.IOException
- when communication fails in any way
-
receiveProtoMessage
public static AimsunControlProtoBuf.OTSMessage receiveProtoMessage(java.io.InputStream inputStream) throws java.io.IOException
Read one OTSMessage.- Parameters:
inputStream
- InputStream; input stream to read from- Returns:
- OTSMessage; the OTSMessage that was constructed from the read bytes
- Throws:
java.io.IOException
- when communication fails
-
receiveBytes
public static byte[] receiveBytes(java.io.InputStream inputStream, int size) throws java.io.IOException
Read a specified number of bytes.- Parameters:
inputStream
- InputStream; input stream to read fromsize
- int; number of bytes to read- Returns:
- byte[]; byte array filled with the read bytes
- Throws:
java.io.IOException
- when communication fails
-
-