|
26 | 26 | import io.netty.channel.DefaultFileRegion; |
27 | 27 | import io.netty.channel.FileRegion; |
28 | 28 | import io.netty.channel.SimpleChannelInboundHandler; |
| 29 | +import io.netty.channel.socket.oio.OioSocketChannel; |
29 | 30 | import io.netty.util.AbstractReferenceCounted; |
30 | 31 | import io.netty.util.internal.ObjectUtil; |
31 | 32 | import io.netty.util.internal.PlatformDependent; |
|
49 | 50 | import static org.junit.jupiter.api.Assertions.assertEquals; |
50 | 51 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; |
51 | 52 | import static org.junit.jupiter.api.Assertions.assertNotEquals; |
| 53 | +import static org.junit.jupiter.api.Assumptions.assumeFalse; |
52 | 54 | import static org.junit.jupiter.api.Assumptions.assumeTrue; |
53 | 55 |
|
54 | 56 | public class SocketFileRegionTest extends AbstractSocketTest { |
@@ -215,6 +217,15 @@ protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) { |
215 | 217 | Channel sc = sb.bind().sync().channel(); |
216 | 218 | Channel cc = cb.connect(sc.localAddress()).sync().channel(); |
217 | 219 | try { |
| 220 | + // OioByteStreamChannel#doWriteFileRegion drains using a locally-tracked |
| 221 | + // bytes-written counter as the transferTo position (ignoring transferred()), so an |
| 222 | + // ill-behaved FileRegion that advances transferred() past actual bytes written -- |
| 223 | + // the exact pattern this fixture uses to exercise the overshoot path -- cannot |
| 224 | + // satisfy OIO's loop without violating the position invariant. The overshoot |
| 225 | + // detection is meaningless on OIO for the same reason; skip the permutation. |
| 226 | + assumeFalse(cc instanceof OioSocketChannel, |
| 227 | + "OIO transport does not honour transferred() for drain-loop termination"); |
| 228 | + |
218 | 229 | OvershootDetectingFileRegion region = new OvershootDetectingFileRegion(regionSize); |
219 | 230 | // sync() blocks until the write future completes, by which point every |
220 | 231 | // transferTo() call the transport is going to make has already been made -- |
|