Package it.polito.appeal.traci.protocol

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


        reqMsg.append(req);
      }
    }
   
    reqMsg.writeTo(dos);
    ResponseMessage respMsg = new ResponseMessage(dis);
    Iterator<ResponseContainer> responseIterator = respMsg.responses().iterator();
    for (Query q : queries) {
      q.pickResponses(responseIterator);     
    }
  }
View Full Code Here


          0, 0, 0, 0// status descr len
          2,           // resp len
          0            // resp code
          });
    DataInputStream dis = new DataInputStream(bais);
    new ResponseMessage(dis);
  }
View Full Code Here

  public void testGetVersionHighLevel() throws IOException {
    RequestMessage reqm = new RequestMessage();
    reqm.append(new Command(Constants.CMD_GETVERSION));
    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_GETVERSION, pair.getStatus().id());
   
    Command resp = pair.getResponse();
    assertEquals(Constants.CMD_GETVERSION, resp.id());
    assertEquals(1, resp.content().readInt());
View Full Code Here

  public void testCloseHighLevel() throws IOException {
    RequestMessage reqm = new RequestMessage();
    reqm.append(new Command(Constants.CMD_CLOSE));
    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_CLOSE, pair.getStatus().id());
    assertEquals("Goodbye", pair.getStatus().description()); // undocumented!
   
    assertNull(pair.getResponse());
  }
View Full Code Here

          0, 0, 0, 0// status descr len
          2,           // resp len
          0            // resp code
          });
    DataInputStream dis = new DataInputStream(bais);
    new ResponseMessage(dis);
  }
View Full Code Here

  public void testGetVersionHighLevel() throws IOException {
    RequestMessage reqm = new RequestMessage();
    reqm.append(new Command(Constants.CMD_GETVERSION));
    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_GETVERSION, pair.getStatus().id());
   
    Command resp = pair.getResponse();
    assertEquals(Constants.CMD_GETVERSION, resp.id());
    assertEquals(API_VERSION, resp.content().readInt());
View Full Code Here

  public void testCloseHighLevel() throws IOException {
    RequestMessage reqm = new RequestMessage();
    reqm.append(new Command(Constants.CMD_CLOSE));
    reqm.writeTo(outStream);
   
    ResponseMessage respm = new ResponseMessage(inStream);
    assertEquals(1, respm.responses().size());
   
    ResponseContainer pair = respm.responses().get(0);
    assertEquals(Constants.CMD_CLOSE, pair.getStatus().id());
   
    assertNull(pair.getResponse());
  }
View Full Code Here

   * @param msg
   * @throws IOException
   */
  protected ResponseMessage doQuery(RequestMessage msg) throws IOException {
    msg.writeTo(getOutStream());
    return new ResponseMessage(inStream);
  }
View Full Code Here

   */
  protected ResponseMessage queryAndVerify(RequestMessage reqMsg) throws IOException {
   
    reqMsg.writeTo(getOutStream());
   
    ResponseMessage respMsg = new ResponseMessage(inStream);

    List<Command> commands = reqMsg.commands();
    List<ResponseContainer> responses = respMsg.responses();
    if (commands.size() > responses.size())
      throw new TraCIException("not enough responses received");
   
    for (int i=0; i<commands.size(); i++) {
      Command cmd = commands.get(i);
View Full Code Here

   * @throws IOException
   */
  protected ResponseContainer doQuerySingle(Command request) throws IOException {
    RequestMessage msg = new RequestMessage();
    msg.append(request);
    ResponseMessage resp = doQuery(msg);
    return resp.responses().iterator().next();
  }
View Full Code Here

TOP

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

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.