protected void handleResponse(
     Channel channel, StreamInput buffer, final TransportResponseHandler handler) {
   final TransportResponse response = handler.newInstance();
   response.remoteAddress(
       new InetSocketTransportAddress((InetSocketAddress) channel.getRemoteAddress()));
   response.remoteAddress();
   try {
     response.readFrom(buffer);
   } catch (Throwable e) {
     handleException(
         handler,
         new TransportSerializationException(
             "Failed to deserialize response of type [" + response.getClass().getName() + "]", e));
     return;
   }
   try {
     if (handler.executor() == ThreadPool.Names.SAME) {
       //noinspection unchecked
       handler.handleResponse(response);
     } else {
       threadPool.executor(handler.executor()).execute(new ResponseHandler(handler, response));
     }
   } catch (Throwable e) {
     handleException(handler, new ResponseHandlerFailureTransportException(e));
   }
 }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    phase1FileNames = Lists.newArrayListWithCapacity(size);
    for (int i = 0; i < size; i++) {
      phase1FileNames.add(in.readUTF());
    }
    size = in.readVInt();
    phase1FileSizes = Lists.newArrayListWithCapacity(size);
    for (int i = 0; i < size; i++) {
      phase1FileSizes.add(in.readVLong());
    }

    size = in.readVInt();
    phase1ExistingFileNames = Lists.newArrayListWithCapacity(size);
    for (int i = 0; i < size; i++) {
      phase1ExistingFileNames.add(in.readUTF());
    }
    size = in.readVInt();
    phase1ExistingFileSizes = Lists.newArrayListWithCapacity(size);
    for (int i = 0; i < size; i++) {
      phase1ExistingFileSizes.add(in.readVLong());
    }

    phase1TotalSize = in.readVLong();
    phase1ExistingTotalSize = in.readVLong();
    phase1Time = in.readVLong();
    phase1ThrottlingWaitTime = in.readVLong();
    startTime = in.readVLong();
    phase2Operations = in.readVInt();
    phase2Time = in.readVLong();
    phase3Operations = in.readVInt();
    phase3Time = in.readVLong();
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   shardTarget = readSearchShardTarget(in);
   result = readQueryFetchSearchResult(in);
   result.shardTarget(shardTarget);
 }
 protected void handleResponse(
     StreamInput buffer, LocalTransport sourceTransport, final TransportResponseHandler handler) {
   buffer = new NamedWriteableAwareStreamInput(buffer, namedWriteableRegistry);
   final TransportResponse response = handler.newInstance();
   response.remoteAddress(sourceTransport.boundAddress.publishAddress());
   try {
     response.readFrom(buffer);
   } catch (Throwable e) {
     handleException(
         handler,
         new TransportSerializationException(
             "Failed to deserialize response of type [" + response.getClass().getName() + "]", e));
     return;
   }
   handleParsedResponse(response, handler);
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   nodeId = in.readString();
   totalShards = in.readVInt();
   int resultsSize = in.readVInt();
   results = new ArrayList<>(resultsSize);
   for (; resultsSize > 0; resultsSize--) {
     final ShardOperationResult result = in.readBoolean() ? readShardResult(in) : null;
     results.add(result);
   }
   if (in.readBoolean()) {
     int failureShards = in.readVInt();
     exceptions = new ArrayList<>(failureShards);
     for (int i = 0; i < failureShards; i++) {
       exceptions.add(new BroadcastShardOperationFailedException(in));
     }
   } else {
     exceptions = null;
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   ack = in.readBoolean();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   connectedToMaster = in.readBoolean();
 }