public void handle(ClientData clientData) {
    HttpServerRequest req = clientData.getRequest();
    HttpServerResponse res = req.response;
    String requestedFileName = clientData.getPath();
    String resourceRootDir = getRootDir();

    File rootDir = new File(requestedFileName);
    if (!rootDir.exists()) {
      copyFilesToDir();
    }

    switch (requestedFileName) {
      case "/static/flashsocket/WebSocketMainInsecure.swf":
        res.sendFile(resourceRootDir + "/WebSocketMainInsecure.swf");
        break;
      case "/static/flashsocket/WebSocketMain.swf":
        res.sendFile(resourceRootDir + "/WebSocketMain.swf");
        break;
      case "/socket.io.js":
        res.sendFile(resourceRootDir + "/socket.io.js");
        break;
      case "/socket.io.min.js":
        res.sendFile(resourceRootDir + "/socket.io.min.js");
        break;
      default:
        throw new IllegalArgumentException(requestedFileName);
    }
    res.close();
  }
  public WebSocketTransport(Manager manager, ClientData clientData) {
    super(manager, clientData);

    webSocket = clientData.getSocket();

    webSocket.exceptionHandler(
        new Handler<Exception>() {
          public void handle(Exception e) {
            end("socket error " + ((e != null) ? e.getMessage() : ""));
          }
        });

    webSocket.closedHandler(
        new Handler<Void>() {
          public void handle(Void event) {
            end("socket end");
          }
        });

    webSocket.dataHandler(
        new Handler<Buffer>() {
          public void handle(Buffer buffer) {
            onMessage(parser.decodePacket(buffer.toString()));
          }
        });
  }