/**
   * Send a hello message to the switch using the handshake transactions ids.
   *
   * @throws IOException
   */
  private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
      List<OFHelloElem> he = new ArrayList<OFHelloElem>();
      he.add(factory.buildHelloElemVersionbitmap().setBitmaps(ofBitmaps).build());
      builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--).build();

    write(m);
    log.debug("Send hello: {}", m);
  }
 private void sendEchoReply(OFEchoRequest request) {
   OFEchoReply reply =
       factory.buildEchoReply().setXid(request.getXid()).setData(request.getData()).build();
   write(reply);
 }
 private void sendEchoRequest() {
   OFEchoRequest request = factory.buildEchoRequest().setXid(handshakeTransactionIds--).build();
   /* Record for latency calculation */
   echoSendTime = System.currentTimeMillis();
   write(request);
 }
 /**
  * Send a features request message to the switch using the handshake transactions ids.
  *
  * @throws IOException
  */
 private void sendFeaturesRequest() throws IOException {
   // Send initial Features Request
   OFFeaturesRequest m = factory.buildFeaturesRequest().setXid(handshakeTransactionIds--).build();
   write(m);
 }