@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() {
        }
    });
}