if (mTrace) trace(OzUtil.byteBufferDebugDump("write wrapping ", srcbb, false));
if (mTrace) debug(OzUtil.byteBufferDebugDump("write wrapping ", srcbb, false));
    public boolean flush() throws IOException {        synchronized (mPendingWriteBuffers) {            for (Iterator<ByteBuffer> iter = mPendingWriteBuffers.iterator(); iter.hasNext();) {                ByteBuffer srcbb = iter.next();                while (srcbb.hasRemaining()) {                    if (mWrappedBB == null || mWrappedBB.hasRemaining()) {                        /* the next stage filter didn't manage to drain the                         * buffer, so we have to allocate a new one */                        mWrappedBB = ByteBuffer.allocate(mPacketBufferSize);                    } else {                        mWrappedBB.clear();                    }                                        if (mTrace) trace(OzUtil.byteBufferDebugDump("write wrapping ", srcbb, false));                    String ibefore = null, obefore = null;                    if (mDebug) ibefore = OzUtil.toString(srcbb);                    if (mDebug) obefore = OzUtil.toString(mWrappedBB);                                         SSLEngineResult result = mSSLEngine.wrap(srcbb, mWrappedBB);                                        if (mDebug) debug("write wrap " + toString(result) + " in:"+ ibefore + "->" + OzUtil.toString(srcbb) + " out:" + obefore + "->" + OzUtil.toString(mWrappedBB));                                        switch (result.getStatus()) {                	case OK:                		if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {                			runTasks();                		}                		mWrappedBB.flip();                		getNextFilter().write(mWrappedBB);                		break;                	default: // CLOSED BUFFER_OVERFLOW BUFFER_UNDERFLOW:                		throw new IOException("TLS: invalid status during write: " + result.getStatus());                	}                }                iter.remove();            }            return true;        }    }