@Override
    public CommandPackage invokeCommandSync(CommandPackage commandPackage, int timeoutms)
                                                                                         throws DistributeCommonException {
        //没有在运行，不能发送
        if (!isRunning()) {
            throw new NetException("还没有启动连接,或者连接还没有完成");
        }
        //发送数据
        ChannelFuture future = channel.write(commandPackage);
        //保存发送的数据的信息
        SendingPackageInfo sendingPackageInfo = new SendingPackageInfo();
        //初始化保存的发送数据信息
        sendingPackageInfo.setChannelFuture(future);
        sendingPackageInfo.setAsync(false);
        sendingPackageInfo.setCommandPackage(commandPackage);
        sendingPackageInfo.setCountDownLatch(new CountDownLatch(1));
        //保存到请求结果处
        responsePackages.put(commandPackage.getOpaque(), sendingPackageInfo);
        //等待超时
        try {
            sendingPackageInfo.getCountDownLatch().await(timeoutms, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            //throw new DistributeCommonException(e);
            e.printStackTrace();
            ;
        }
        //获取报文信息
        sendingPackageInfo = responsePackages.remove(commandPackage.getOpaque());
        //不可能出现的情况
        if (sendingPackageInfo == null) {
            throw new DistributeCommonException("无法获取报文[" + commandPackage + "]的报文信息");
        }
        //无法获取响应的报文
        if (sendingPackageInfo.getResponsePackage() == null) {
            Throwable cause = sendingPackageInfo.getCause();
            //出现异常
            if (cause != null) {
                if (cause instanceof DistributeCommonException) {
                    throw (DistributeCommonException) cause;
                } else {
                    throw new DistributeCommonException(cause);
                }
            } else {
                //超时
                throw new NetTimeoutException("invokeCommandSync发生超时");
            }
        }
        //成功获取到响应报文

        return sendingPackageInfo.getResponsePackage();
    }