TESTS: Set SO_LINGER = 0 for MockNioTransport (#32560)
* TESTS: Set SO_LINGER = 0 for MockNioTransport * Prevents lingering sockets in TIME_WAIT piling up during test runs and leading to port collisions that manifest as timeouts * Fixes #32552
This commit is contained in:
parent
99513b306e
commit
0cf0d73813
|
@ -182,6 +182,7 @@ public class MockTcpTransport extends TcpTransport {
|
||||||
executor.submit(() -> {
|
executor.submit(() -> {
|
||||||
try {
|
try {
|
||||||
socket.connect(address);
|
socket.connect(address);
|
||||||
|
socket.setSoLinger(false, 0);
|
||||||
channel.loopRead(executor);
|
channel.loopRead(executor);
|
||||||
connectListener.onResponse(null);
|
connectListener.onResponse(null);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -193,6 +193,7 @@ public class MockNioTransport extends TcpTransport {
|
||||||
BytesChannelContext context = new BytesChannelContext(nioChannel, selector, (e) -> exceptionCaught(nioChannel, e),
|
BytesChannelContext context = new BytesChannelContext(nioChannel, selector, (e) -> exceptionCaught(nioChannel, e),
|
||||||
readWriteHandler, new InboundChannelBuffer(pageSupplier));
|
readWriteHandler, new InboundChannelBuffer(pageSupplier));
|
||||||
nioChannel.setContext(context);
|
nioChannel.setContext(context);
|
||||||
|
nioChannel.setSoLinger(0);
|
||||||
return nioChannel;
|
return nioChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue