code: public synchronized void download(StaplerRequest req, StaplerResponse rsp) throws InterruptedException, IOException {
          rsp.setStatus(HttpServletResponse.SC_OK);
  
          // server->client channel.
          // this is created first, and this controls the lifespan of the channel
          rsp.addHeader("Transfer-Encoding", "chunked");
          OutputStream out = rsp.getOutputStream();
          if (DIY_CHUNKING) {
              out = new ChunkedOutputStream(out);
          }
  
          // send something out so that the client will see the HTTP headers
          out.write(0);
          out.flush();
  
          {// wait until we have the other channel
              long end = System.currentTimeMillis() + CONNECTION_TIMEOUT;
              while (upload == null && System.currentTimeMillis() < end) {
                  LOGGER.log(Level.FINE, "Waiting for upload stream for {0}: {1}", new Object[] {uuid, this});
                  wait(1000);
              }
  
              if (upload == null) {
                  throw new IOException("HTTP full-duplex channel timeout: " + uuid);
              }
  
              LOGGER.log(Level.FINE, "Received upload stream {0} for {1}: {2}", new Object[] {upload, uuid, this});
          }
  
          try {
              run(upload, out);
          } finally {
              // publish that we are done
              completed = true;
              notify();
          }
      }
docs: This is where we send the data to the client.
  
  <p>
  If this connection is lost, we'll abort the channel.