jenkinsci/remoting — pull request #5 by dty (2012-06-27 00:09:50+00:00)
Title: Debugging classes to capture data that's coming across the remoting channel.

This set of commits introduce the ability to enable capturing data dumps of data that is written to and/or read from the remoting channel.

Captured data is stored in a configurable ring buffer. While the ring buffer class supports remembering first n and last m items, the capturing stream only exposes capturing the last n items.

Capturing is enabled with system properties, hudson.remoting.ClassicCommandTransport.captureInput and .captureOutput. When enabled, a capturing stream is wrapped around the underlying input and output streams to intercept read and write calls to copy the data into the appropriate ring buffer.

When an IOException is thrown on a read or write, data captured in the ring buffers are dumped in a combo hex/ASCII format to stderr.