Revert "[JENKINS-20769] Trying to fix/suppress some related observed or actual NPEs."

This reverts commit eb3a4c380e695580174ce381a8330e8e2b8a9b2e.

Reverting this commit to unmask the problem.
Revert "NPE observed in log while trying to reconnect a slave."

This reverts commit 622af099d6b94569c873b8fcd2d1bc65860a8cc6.

Simiarly, reverting to unmask the root cause of JENKINS-20769.
These problems are indicative of a deeper problem, and shouldn't
be just swept under the rug.
[JENKINS-20769] adding a test case that reproduces the problem.
grammatical fix, I think
[FIXED JENKINS-20769]

When ProxyWriter is finalized, it should attempt to release a remote reference count,
but it shouldn't try to close the stream. For one, the other side that had exported
the writer might be still using it (imagine exporting System.out), and secondly, the
said object could have already been unexported, for example if the closure that brought
ProxyWriter to this side has already returned, since RemoteWriter is auto-unexporting.

Compare ProxyOutputStream impl vs ProxyWriter impl and the difference becomes clearer.
Brought ProxyWriter on par with ProxyOutputStream.

Since ProxyOutputStream is used far more often than ProxyWriter, it looks like we've failed
to keep them both up to the same level.

This change ports newer features and fixes from ProxyOutputStream to ProxyWriter, including
flushing, throttling, and I/O synchronization.

Since the code looks so similar, one wonders if there is any way to unify them, but
this turns out to be tricky because of the need to remain backward compatible. Command objects
for example need to be available in the exact same name, which means if we are to try to
unify them, we'd end up creating 3 copies (one in ProxyOutputStream, onein ProxyWriter, and
one in the unified version.) So I'm sticking to two copies.
improved the coverage
[JENKINS-20769]

Unexport is new, so for older versions fall back to EOF.
Better to have a bogus error message than memory leak.
adding another test