// reject if the host doesn't match
  public void setHost(String host) throws ActiveMQStompException {
    if (host == null) {
      ActiveMQStompException error = BUNDLE.nullHostHeader().setHandler(frameHandler);
      error.setBody(BUNDLE.hostCannotBeNull());
      throw error;
    }

    String localHost = manager.getVirtualHostName();
    if (!host.equals(localHost)) {
      ActiveMQStompException error = BUNDLE.hostNotMatch().setHandler(frameHandler);
      error.setBody(BUNDLE.hostNotMatchDetails(host));
      throw error;
    }
  }
  /*
   * accept-version value takes form of "v1,v2,v3..."
   * we need to return the highest supported version
   */
  public void negotiateVersion(StompFrame frame) throws ActiveMQStompException {
    String acceptVersion = frame.getHeader(Stomp.Headers.ACCEPT_VERSION);

    if (acceptVersion == null) {
      this.version = StompVersions.V1_0;
    } else {
      StringTokenizer tokenizer = new StringTokenizer(acceptVersion, ",");
      Set<String> requestVersions = new HashSet<String>(tokenizer.countTokens());
      while (tokenizer.hasMoreTokens()) {
        requestVersions.add(tokenizer.nextToken());
      }

      if (requestVersions.contains(StompVersions.V1_2.toString())) {
        this.version = StompVersions.V1_2;
      } else if (requestVersions.contains(StompVersions.V1_1.toString())) {
        this.version = StompVersions.V1_1;
      } else if (requestVersions.contains(StompVersions.V1_0.toString())) {
        this.version = StompVersions.V1_0;
      } else {
        // not a supported version!
        ActiveMQStompException error =
            BUNDLE.versionNotSupported(acceptVersion).setHandler(frameHandler);
        error.addHeader(Stomp.Headers.Error.VERSION, manager.getSupportedVersionsAsErrorVersion());
        error.addHeader(Stomp.Headers.CONTENT_TYPE, "text/plain");
        error.setBody("Supported protocol versions are " + manager.getSupportedVersionsAsString());
        error.setDisconnect(true);
        throw error;
      }
    }

    if (this.version != (StompVersions.V1_0)) {
      VersionedStompFrameHandler newHandler =
          VersionedStompFrameHandler.getHandler(this, this.version);
      newHandler.initDecoder(this.frameHandler);
      this.frameHandler = newHandler;
    }
    this.initialized = true;
  }