[#1242] Fix infinity-loop which was triggered when a write failed and AioSocketChannel was used