public void start() throws IOException, InterruptedException {
        File snapFile = new File(this.snapDir).getAbsoluteFile();
        if (!snapFile.exists()) {
            snapFile.mkdirs();
        }
        File logFile = new File(this.logDir).getAbsoluteFile();
        if (!logFile.exists()) {
            logFile.mkdirs();
        }

        ZooKeeperServer server = new ZooKeeperServer(snapFile, logFile, this.tickTime);
        this.standaloneServerFactory =
                NIOServerCnxnFactory.createFactory(new InetSocketAddress(this.port), this.maxConnections);
        this.standaloneServerFactory.startup(server);
        logger.info("Startup zookeeper server at port :" + this.port);
    }
An embed zookeeper server.

@author dennis<killme2008@gmail.com>
metamorphosis-server/src/main/java/com/taobao/metamorphosis/server/assembly/EmbedZookeeperServer.java