Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Fix connection kill test
Browse files Browse the repository at this point in the history
'#startUpdateAdvertisingAndListening - destroying the local connection
kills the connection to the remote peer' test destroys socket, then
tries to to connect to the same port again and expects this connection
to fail. But on desktop with mocked mobile layer reconnecting happens
too fast before everything is closed properly. So connection after close
has to be done asynchronously after the 'close' event
  • Loading branch information
chapko committed Jan 16, 2017
1 parent 2fe619c commit 97b5767
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/www/jxcore/bv_tests/testThaliMobileNativeAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ function killSkeleton(t, createServerWriteSuccessHandler,

connectToListeningPort.on('close', function () {
t.ok(gotCloseMessage, 'We got the close message and we are closed');
connectToListeningPortCloseHandler(connection, testMessage,
closeMessage, peer);
// Call close handler asynchronously to give mock proxy sockets a time
// to shut down completely.
setImmediate(function () {
connectToListeningPortCloseHandler(connection, testMessage,
closeMessage, peer);
});
});
}

Expand Down

0 comments on commit 97b5767

Please sign in to comment.