Skip to content

Commit

Permalink
fix random test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Maldini committed Feb 27, 2018
1 parent 4960c0f commit 63729e5
Showing 1 changed file with 8 additions and 9 deletions.
Expand Up @@ -41,6 +41,8 @@
import reactor.ipc.netty.http.server.HttpServer;
import reactor.ipc.netty.resources.PoolResources;
import reactor.test.StepVerifier;
import reactor.util.Logger;
import reactor.util.Loggers;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -137,6 +139,8 @@ public void testChannelInactiveThrowsIOException() throws Exception {
abortServer.close();
}

static final Logger log = Loggers.getLogger(ChannelOperationsHandlerTest.class);

private static final class ConnectionAbortServer extends CountDownLatch implements Runnable {

private final int port;
Expand Down Expand Up @@ -165,23 +169,18 @@ public void run() {
thread = Thread.currentThread();
while (true) {
SocketChannel ch = server.accept();

while (true) {
int bytes = ch.read(ByteBuffer.allocate(256));
if (bytes > 0) {
if (!read) {
read = true;
}
else {
ch.close();
server.socket().close();
return;
}
ch.close();
server.socket().close();
return;
}
}
}
}
catch (IOException e) {
e.printStackTrace();
}
}

Expand Down

0 comments on commit 63729e5

Please sign in to comment.