B2G/gecko/dom/network/tests/unit/test_tcpsocket.js
/**
 * Test that when the client closes the connection, the onclose callback
 * is fired on the server side.
 */
Test that when the client closes the connection, the onclose callback
is fired on the server side.
Test that when the client closes the connection the onclose callback is fired on the server side .
function clientCloses() {
  var yayFuncs = makeJointSuccess(['clientclose', 'serverclose']);
  server.onclose = yayFuncs.serverclose;
  sock.onclose = yayFuncs.clientclose;
  sock.close();
}
function clientCloses ( ) { var yayFuncs = makeJointSuccess ( [ 'clientclose' , 'serverclose' ] ) ; server . onclose = yayFuncs . serverclose ; sock . onclose = yayFuncs . clientclose ; sock . close ( ) ; }
Test that when the client closes the connection, the onclose callback
 is fired on the server side.
Test that when the client closes the connection the onclose callback is fired on the server side .
// we want to make sure the server heard the close and also that the client's // onclose event fired for consistency.