int serverPort = getFreePort();
zkServerFactoryBean = new ZKServerFactoryBean();
zkServerFactoryBean.setPurge(true);
zkServerFactoryBean.setClientPortAddress(new InetSocketAddress("localhost", zooKeeperPort));
zkServerFactoryBean.afterPropertiesSet();
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString("localhost:" + zooKeeperPort)
.retryPolicy(new RetryOneTime(1000))
.connectionTimeoutMs(60000);