progress = true;
// If the tests wants to block, then block
while (_blockAt > 0 && _endp.isOpen() && _in.remaining() < _blockAt)
{
FutureCallback blockingRead = new FutureCallback();
fillInterested(blockingRead);
blockingRead.get();
filled = _endp.fill(_in);
progress |= filled > 0;
}
// Copy to the out buffer
if (BufferUtil.hasContent(_in) && BufferUtil.append(_out, _in) > 0)
progress = true;
// Blocking writes
if (BufferUtil.hasContent(_out))
{
ByteBuffer out = _out.duplicate();
BufferUtil.clear(_out);
for (int i = 0; i < _writeCount; i++)
{
FutureCallback blockingWrite = new FutureCallback();
_endp.write(blockingWrite, out.asReadOnlyBuffer());
blockingWrite.get();
}
progress = true;
}
// are we done?
if (_endp.isInputShutdown())
_endp.shutdownOutput();
}
}
catch (ExecutionException e)
{
// Timeout does not close, so echo exception then shutdown
try
{
FutureCallback blockingWrite = new FutureCallback();
_endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in)));
blockingWrite.get();
_endp.shutdownOutput();
}
catch (Exception e2)
{
// e2.printStackTrace();