@Override
    public void start() {
        if (started) {
            return;
        }
        synchronized (this) {
            if (started) {
                return;
            }
            // 绑定到端口
            try {
                httpServer.start();
                if (LOGGER.isInfoEnabled()) {
                    LOGGER.info("Start the http rest server at port {}", serverConfig.getPort());
                }
            } catch (SofaRpcRuntimeException e) {
                throw e;
            } catch (Exception e) {
                throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_START_SERVER_WITH_PORT, "rest",
                    serverConfig.getPort()), e);
            }
            started = true;
        }
    }
@Test
    public void start() {
        String host = "127.0.0.1";
        int port = 18801;
        ServerConfig serverConfig = new ServerConfig();
        serverConfig.setBoundHost(host);
        serverConfig.setPort(port);
        serverConfig.setProtocol(RpcConstants.PROTOCOL_TYPE_REST);

        RestServer server = new RestServer();
        server.init(serverConfig);
        server.start();
        Assert.assertTrue(server.started);
        Assert.assertTrue(NetUtils.canTelnet(host, port, 1000));
        // 重复启动
        server.start();

        server.stop();
        Assert.assertFalse(server.started);
        Assert.assertFalse(NetUtils.canTelnet(host, port, 1000));
        // 重复关闭
        server.stop();

        // 销毁
        server.init(serverConfig);
        server.start();
        Assert.assertTrue(server.started);
        Assert.assertTrue(NetUtils.canTelnet(host, port, 1000));
        server.destroy(null);

        // 销毁
        server.init(serverConfig);
        server.start();
        Assert.assertTrue(server.started);
        Assert.assertTrue(NetUtils.canTelnet(host, port, 1000));
        server.destroy(new Destroyable.DestroyHook() {
            @Override
            public void preDestroy() {

            }

            @Override
            public void postDestroy() {

            }
        });
    }