Package it.polito.appeal.traci.protocol

Examples of it.polito.appeal.traci.protocol.Command


    this.commandID = commandID;
  }

  @Override
  List<Command> getRequests() {
    Command cmd = new Command(commandID);
    writeRequestTo(cmd.content());
    return Collections.singletonList(cmd);
  }
View Full Code Here


  public CloseQuery(Socket sock) throws IOException {
    super(sock);
  }

  public void doCommand() throws IOException {
    Command req = new Command(Constants.CMD_CLOSE);
    queryAndVerifySingle(req);
  }
View Full Code Here

    this.varID = varID;
  }
 
  @Override
  List<Command> getRequests() {
    Command cmd = new Command(commandID);
    Storage content = cmd.content();
    content.writeByte(varID);
    content.writeStringASCII(objectID);
    return Collections.singletonList(cmd);
  }
View Full Code Here

  @Override
  void pickResponses(Iterator<ResponseContainer> responseIterator) throws TraCIException {
    ResponseContainer respc = responseIterator.next();
    StatusResponse statusResp = respc.getStatus();
    Utils.checkStatusResponse(statusResp, commandID);
    Command resp = respc.getResponse();
    Utils.checkByte(resp.content(), varID);
    Utils.checkObjectID(resp.content(), objectID);
   
    V value = readValue(resp);
    setDone(value);
  }
View Full Code Here

  }

  @Test
  public void testAppend() {
    RequestMessage m = new RequestMessage();
    Command cmd = new Command(0xAA);
    m.append(cmd);
    assertEquals(cmd, m.commands().iterator().next());
  }
View Full Code Here

  }

  @Test
  public void testWriteTo() throws IOException {
    RequestMessage m = new RequestMessage();
    Command cmd = new Command(0xAA);
    m.append(cmd);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    m.writeTo(dos);
View Full Code Here

  }

  @Test
  public void testCommandStorage() {
    Storage s = sampleStorage();
    new Command(s);
  }
View Full Code Here

    return new Storage(buf);
  }

  @Test
  public void testCommandInt() {
    new Command(A_COMMAND_ID);
  }
View Full Code Here

    new Command(A_COMMAND_ID);
  }

  @Test
  public void testId() {
    Command cmd = new Command(sampleStorage());
    assertEquals(A_COMMAND_ID, cmd.id());
  }
View Full Code Here

    assertEquals(A_COMMAND_ID, cmd.id());
  }

  @Test
  public void testContent() {
    Command cmd = new Command(sampleStorage());
    assertEquals(AN_INTEGER, cmd.content().readInt());
  }
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.protocol.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.