@Override
    protected void writeRequest(final int protocolVersion, final FlushableDataOutput output)
        throws IOException {
      try {
        log.tracef("Client writing request %d", getBatchId());
        activeRequests.put(getBatchId(), executeRequestContext);

        output.write(ModelControllerProtocol.PARAM_OPERATION);
        operation.writeExternal(output);
        output.write(ModelControllerProtocol.PARAM_INPUTSTREAMS_LENGTH);
        int inputStreamLength = 0;
        if (executeRequestContext.getAttachments() != null) {
          List<InputStream> streams = executeRequestContext.getAttachments().getInputStreams();
          if (streams != null) {
            inputStreamLength = streams.size();
          }
        }
        output.writeInt(inputStreamLength);
        log.tracef("Client wrote request %d successfully", getBatchId());
      } catch (Exception e) {
        log.tracef(e, "Client wrote request %d with error", getBatchId());
        setError(e);
        if (e instanceof IOException) {
          throw (IOException) e;
        }
        if (e instanceof RuntimeException) {
          throw (RuntimeException) e;
        }
        throw new IOException(e);
      }
    }
 @Override
 protected void writeResponse(final FlushableDataOutput output) throws IOException {
   output.write(ModelControllerProtocol.PARAM_INPUTSTREAM_LENGTH);
   output.writeInt(bytes.length);
   output.write(ModelControllerProtocol.PARAM_INPUTSTREAM_CONTENTS);
   output.write(bytes);
   log.tracef("Client handled inputstream request %d", getHeader().getBatchId());
 }
 @Override
 protected void sendRequest(
     ActiveOperation.ResultHandler<Void> resultHandler,
     ManagementRequestContext<Void> voidManagementRequestContext,
     FlushableDataOutput output)
     throws IOException {
   output.write(DomainControllerProtocol.PARAM_HOST_ID);
   output.writeUTF(localHostName);
 }
 @Override
 protected void sendRequest(
     final ActiveOperation.ResultHandler<Void> resultHandler,
     final ManagementRequestContext<Void> context,
     final FlushableDataOutput output)
     throws IOException {
   output.write(DomainControllerProtocol.PARAM_HOST_ID);
   output.writeUTF(localHostName);
   ModelNode hostInfo = localHostInfo.clone();
   hostInfo
       .get(RemoteDomainConnectionService.DOMAIN_CONNECTION_ID)
       .set(pongHandler.getConnectionId());
   hostInfo.writeExternal(output);
 }