### Question:
GrpcOutputStream extends OutputStream { @Override public void close() throws IOException { flushBuffer(true); LOG.info("Sent {} bytes for container {}", writtenBytes, containerId); responseObserver.onCompleted(); buffer.close(); } GrpcOutputStream(
      StreamObserver<CopyContainerResponseProto> responseObserver,
      long containerId, int bufferSize); @Override void write(int b); @Override void write(@Nonnull byte[] data, int offset, int length); @Override void close();  }### Answer:
@Test public void singleArraySpansMultipleResponses() throws IOException { byte[] bytes = writeBytes(subject, 2 * bufferSize + bufferSize/2); subject.close(); verifyResponses(bytes); }
@Test public void secondWriteSpillsToNextResponse() throws IOException { byte[] bytes1 = writeBytes(subject, bufferSize / 2); byte[] bytes2 = writeBytes(subject, 2 * bufferSize); subject.close(); verifyResponses(concat(bytes1, bytes2)); }