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
Modifier and Type Method Description static voidmain(String[] args)static byte[]receiveBytes(InputStream inputStream, int size)Read a specified number of bytes.static AimsunControlProtoBuf.OTSMessagereceiveProtoMessage(InputStream inputStream)Read one OTSMessage.static voidsendProtoMessage(OutputStream outputStream, AimsunControlProtoBuf.OTSMessage message)Transit one message to the OTS server.
-
Method Details
-
main
- Parameters:
args- String[]; command line arguments- Throws:
IOException- when communication fails
-
sendProtoMessage
public static void sendProtoMessage(OutputStream outputStream, AimsunControlProtoBuf.OTSMessage message) throws IOExceptionTransit 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 IOExceptionRead 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
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
-