DERBY-5317: Detect attempts to reuse a connection that in the middle of sending a request to the server. Use this to provide a better error message and avoid the NPE.
DERBY-6386 - Errors in jdbc4.LobStreamTest if derbyclient.jar is first in the classpath

backported change #1530704 to fix DERBY-5317 from trunk to 10.10, needed some
   hand merging to fix difference in argument ordering between 10.10 and trunk.
backported change #1534425 to fix DERBY-6386 which was caused by DERBY5317 fix.



git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/branches/10.10@1573334 13f79535-47bb-0310-9956-ffa450edef68