B2G/gecko/dom/network/tests/unit/test_tcpsocket.js
/**
 * Test that when the server closes the connection, the onclose callback
 * is fired on the client side.
 */
Test that when the server closes the connection, the onclose callback
is fired on the client side.
Test that when the server closes the connection the onclose callback is fired on the client side .
function serverCloses() {
  var yayFuncs = makeJointSuccess(['clientclose', 'serverclose']);
  sock.ondata = makeFailureCase('data');
  sock.onclose = yayFuncs.clientclose;
  server.onclose = yayFuncs.serverclose;
  server.close();
}
function serverCloses ( ) { var yayFuncs = makeJointSuccess ( [ 'clientclose' , 'serverclose' ] ) ; sock . ondata = makeFailureCase ( 'data' ) ; sock . onclose = yayFuncs . clientclose ; server . onclose = yayFuncs . serverclose ; server . close ( ) ; }
Test that when the server closes the connection, the onclose callback
 is fired on the client side.
Test that when the server closes the connection the onclose callback is fired on the client side .
// we don't really care about the server's close event, but we do want to // make sure it happened for sequencing purposes.