* Perform any actions required on stream closure (handle response etc.)
*/
public void close() throws IOException {
if (buffer != null && buffer.size() > 0) {
thresholdNotReached();
LoadingByteArrayOutputStream tmp = buffer;
buffer = null;
super.write(tmp.getRawBytes(), 0, tmp.size());
}
if (!written) {
handleHeadersTrustCaching();
}
super.flush();