Package org.opentrafficsim.demo
Class TestController
- java.lang.Object
-
- org.opentrafficsim.demo.TestController
-
public final class TestController extends 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(String[] args)
static byte[]
receiveBytes(InputStream inputStream, int size)
Read a specified number of bytes.static AimsunControlProtoBuf.OTSMessage
receiveProtoMessage(InputStream inputStream)
Read one OTSMessage.static void
sendProtoMessage(OutputStream outputStream, AimsunControlProtoBuf.OTSMessage message)
Transit one message to the OTS server.
-
-
-
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 servermessage
- 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 fromsize
- int; number of bytes to read- Returns:
- byte[]; byte array filled with the read bytes
- Throws:
IOException
- when communication fails
-
-