code: public boolean write()
      {
          assert state == State.WRITING;
  
          boolean writeFailed = false;
  
          try
          {
              if (response.streamTo(transport) < 0)
              {
                  writeFailed = true;
                  return false;
              }
              else if (!response.isFullyStreamed())
              {
                  // if socket couldn't accommodate whole write buffer,
                  // continue writing when we get next write signal.
  
                  switchToWrite();
                  return true;
              }
          }
          catch (IOException e)
          {
              logger.error("Got an IOException during write!", e);
              writeFailed = true;
              return false;
          }
          finally
          {
              if (writeFailed || response.isFullyStreamed())
                  response.close();
          }
  
  
  
          // we're done writing. Now we need to switch back to reading.
          switchToRead();
  
          return true;
      }
docs: Give this Message a chance to write its output to the final client.