/**
   * Method description
   *
   * @param p
   * @param serv
   * @param handler
   * @param results
   * @return
   */
  @Override
  public boolean process(
      Packet p, ComponentIOService serv, ComponentProtocolHandler handler, Queue<Packet> results) {
    if (p.isXMLNSStaticStr(Iq.IQ_BIND_PATH, XMLNS)) {
      if ((p.getType() == StanzaType.set) && serv.isAuthenticated()) {
        String hostname = p.getElemCDataStaticStr(IQ_BIND_HOSTNAME_PATH);

        handler.bindHostname(hostname, serv);
        results.offer(Packet.packetInstance(okResult(p.getElement()), null, null));
      } else {
        log.fine("Ok result received: " + p.toString());
      }

      return true;
    }
    if (p.isXMLNSStaticStr(IQ_UNBIND_PATH, XMLNS)) {
      if ((p.getType() == StanzaType.set) && serv.isAuthenticated()) {
        String hostname = p.getElemCDataStaticStr(IQ_BIND_HOSTNAME_PATH);

        handler.unbindHostname(hostname, serv);
        results.offer(Packet.packetInstance(okResult(p.getElement()), null, null));
      } else {
        log.fine("Ok result received: " + p.toString());
      }

      return true;
    }

    return false;
  }
  private Element newBindElement(String host, ComponentProtocolHandler handler) {
    Element result =
        new Element(
            "iq", new String[] {"type", "id"}, new String[] {"set", handler.newPacketId("bind")});
    Element bind =
        new Element(
            EL_NAME,
            new Element[] {new Element("hostname", host)},
            new String[] {"xmlns"},
            new String[] {XMLNS});

    result.addChild(bind);

    return result;
  }