//    getLogWriter().info("[testServerEventsInSystemClient] create bridge client");
//    Properties config = new Properties();
//    config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
//    config.setProperty(DistributionConfig.LOCATORS_NAME, "");
//    getSystem(config);
//    AttributesFactory factory = new AttributesFactory();
//    factory.setScope(Scope.LOCAL);
//    BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, false, -1, -1, null);
//    createRegion(name, factory.create());
//    assertNotNull(getRootRegion().getSubregion(name));
private void doTestServerEventsInSystemClient() throws Exception {
    // KIRK: this test fails intermittently with bug 37482
    final boolean[] firedSystem = new boolean[3];
    final DistributedMember[] memberSystem = new DistributedMember[3];
    final String[] memberIdSystem = new String[3];
    final boolean[] isClientSystem = new boolean[3];
    final boolean[] firedAdapter = new boolean[3];
    final DistributedMember[] memberAdapter = new DistributedMember[3];
    final String[] memberIdAdapter = new String[3];
    final boolean[] isClientAdapter = new boolean[3];
    final boolean[] firedBridge = new boolean[3];
    final DistributedMember[] memberBridge = new DistributedMember[3];
    final String[] memberIdBridge = new String[3];
    final boolean[] isClientBridge = new boolean[3];
    final boolean[] firedSystemDuplicate = new boolean[3];
    final boolean[] firedAdapterDuplicate = new boolean[3];
    final boolean[] firedBridgeDuplicate = new boolean[3];
    SystemMembershipListener systemListener = new SystemMembershipListener() {
      public synchronized void memberJoined(SystemMembershipEvent event) {
        firedSystemDuplicate[JOINED] = firedSystem[JOINED];
        firedSystem[JOINED] = true;
        memberSystem[JOINED] = event.getDistributedMember();
        memberIdSystem[JOINED] = event.getMemberId();
        notify();
      }
      public synchronized void memberLeft(SystemMembershipEvent event) {
        firedSystemDuplicate[LEFT] = firedSystem[LEFT];
        firedSystem[LEFT] = true;
        memberSystem[LEFT] = event.getDistributedMember();
        memberIdSystem[LEFT] = event.getMemberId();
        notify();
      }
      public synchronized void memberCrashed(SystemMembershipEvent event) {
        firedSystemDuplicate[CRASHED] = firedSystem[CRASHED];
        firedSystem[CRASHED] = true;
        memberSystem[CRASHED] = event.getDistributedMember();
        memberIdSystem[CRASHED] = event.getMemberId();
        notify();
      }
    };
    UniversalMembershipListenerAdapter adapter = 
      new UniversalMembershipListenerAdapter() {
      @Override
      public synchronized void memberJoined(SystemMembershipEvent event) {
        getLogWriter().info("[testServerEventsInSystemClient] memberJoined >" + event.getMemberId() + "<");
        firedAdapterDuplicate[JOINED] = firedAdapter[JOINED];
        firedAdapter[JOINED] = true;
        memberAdapter[JOINED] = event.getDistributedMember();
        memberIdAdapter[JOINED] = event.getMemberId();
        if (event instanceof UniversalMembershipListenerAdapter.AdaptedMembershipEvent) {
          isClientAdapter[JOINED] = 
            ((UniversalMembershipListenerAdapter.AdaptedMembershipEvent)event).isClient();
        }
        notify();
      }
      @Override
      public synchronized void memberLeft(SystemMembershipEvent event) {
        getLogWriter().info("[testServerEventsInSystemClient] memberLeft >" + event.getMemberId() + "<");
        firedAdapterDuplicate[LEFT] = firedAdapter[LEFT];
        firedAdapter[LEFT] = true;
        memberAdapter[LEFT] = event.getDistributedMember();
        memberIdAdapter[LEFT] = event.getMemberId();
        if (event instanceof UniversalMembershipListenerAdapter.AdaptedMembershipEvent) {
          isClientAdapter[LEFT] = 
            ((UniversalMembershipListenerAdapter.AdaptedMembershipEvent)event).isClient();
        }
        notify();
      }
      @Override
      public synchronized void memberCrashed(SystemMembershipEvent event) {
        getLogWriter().info("[testServerEventsInSystemClient] memberCrashed >" + event.getMemberId() + "<");
        firedAdapterDuplicate[CRASHED] = firedAdapter[CRASHED];
        firedAdapter[CRASHED] = true;
        memberAdapter[CRASHED] = event.getDistributedMember();
        memberIdAdapter[CRASHED] = event.getMemberId();
        if (event instanceof UniversalMembershipListenerAdapter.AdaptedMembershipEvent) {
          isClientAdapter[CRASHED] = 
            ((UniversalMembershipListenerAdapter.AdaptedMembershipEvent)event).isClient();
        }
        notify();
      }
    };
    BridgeMembershipListener bridgeListener = new BridgeMembershipListener() {
      public synchronized void memberJoined(BridgeMembershipEvent event) {
        firedBridgeDuplicate[JOINED] = firedBridge[JOINED];
        firedBridge[JOINED] = true;
        memberBridge[JOINED] = event.getMember();
        memberIdBridge[JOINED] = event.getMemberId();
        isClientBridge[JOINED] = event.isClient();
        notify();
      }
      public synchronized void memberLeft(BridgeMembershipEvent event) {
        firedBridgeDuplicate[LEFT] = firedBridge[LEFT];
        firedBridge[LEFT] = true;
        memberBridge[LEFT] = event.getMember();
        memberIdBridge[LEFT] = event.getMemberId();
        isClientBridge[LEFT] = event.isClient();
        notify();
      }
      public synchronized void memberCrashed(BridgeMembershipEvent event) {
        firedBridgeDuplicate[CRASHED] = firedBridge[CRASHED];
        firedBridge[CRASHED] = true;
        memberBridge[CRASHED] = event.getMember();
        memberIdBridge[CRASHED] = event.getMemberId();
        isClientBridge[CRASHED] = event.isClient();
        notify();
      }
    };
    final Host host = Host.getHost(0);
    final VM vm0 = host.getVM(0);
    final String name = this.getUniqueName();
    final int[] ports = new int[] 
      { AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET) };
    assertTrue(ports[0] != 0);
//    getLogWriter().info("[testServerEventsInSystemClient] create bridge client");
//    Properties config = new Properties();
//    config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
//    config.setProperty(DistributionConfig.LOCATORS_NAME, "");
//    getSystem(config);
//    AttributesFactory factory = new AttributesFactory();
//    factory.setScope(Scope.LOCAL);
//    BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, false, -1, -1, null);
//    createRegion(name, factory.create());
//    assertNotNull(getRootRegion().getSubregion(name));
    getLogWriter().info("[testServerEventsInSystemClient] create system bridge client");
    getSystem();
    final Properties clientProperties = getSystemProperties();
    // register the bridge listener
    BridgeMembership.registerBridgeMembershipListener(bridgeListener);
    DistributedSystemConfig config = 
      AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), null);
    AdminDistributedSystem adminDS = 
      AdminDistributedSystemFactory.getDistributedSystem(config);
    adminDS.connect();
    assertTrue(adminDS.waitToBeConnected(5 * 1000));
    // register the system listener
    adminDS.addMembershipListener(systemListener);
    // register the universal adapter
    adapter.registerMembershipListener(adminDS);
    // create BridgeServer in vm0...
    SerializableRunnable createBridgeServer =
    new CacheSerializableRunnable("Create BridgeServer") {
      @Override
      public void run2() throws CacheException {
        getLogWriter().info("[testServerEventsInSystemClient] Create BridgeServer");
        getSystem(clientProperties);
        AttributesFactory factory = new AttributesFactory();
        factory.setScope(Scope.LOCAL);
        Region region = createRegion(name, factory.create());
        assertNotNull(region);
        assertNotNull(getRootRegion().getSubregion(name));
        try {
          testServerEventsInSystemClient_port = startBridgeServer(ports[0]);
        }
        catch (IOException e) {
          getLogWriter().error(e);
          fail(e.getMessage());
        }
      }
    };
    vm0.invoke(createBridgeServer);
    // gather details for later creation of BridgeLoader...
    assertEquals(ports[0],
                 vm0.invokeInt(UniversalMembershipListenerAdapterDUnitTest.class, 
                               "getTestServerEventsInSystemClient_port"));
    String serverMemberId = (String) vm0.invoke(
      UniversalMembershipListenerAdapterDUnitTest.class, "getMemberId");
    DistributedMember serverMember = (DistributedMember) vm0.invoke(
      UniversalMembershipListenerAdapterDUnitTest.class, "getDistributedMember");
    getLogWriter().info("[testServerEventsInSystemClient] ports[0]=" + ports[0]);
    getLogWriter().info("[testServerEventsInSystemClient] serverMemberId=" + serverMemberId);
    getLogWriter().info("[testServerEventsInSystemClient] serverMember=" + serverMember);
    // create region which connects to bridge server
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, false, -1, -1, null);
    createRegion(name, factory.create());
    assertNotNull(getRootRegion().getSubregion(name));
    synchronized(systemListener) {
      if (!firedSystem[JOINED]) {
        systemListener.wait(ASYNC_EVENT_WAIT_MILLIS);
      }
    }
    synchronized(adapter) {
      if (!firedAdapter[JOINED]) {
        adapter.wait(ASYNC_EVENT_WAIT_MILLIS);
      }
    }
    synchronized(bridgeListener) {
      if (!firedBridge[JOINED]) {
        bridgeListener.wait(ASYNC_EVENT_WAIT_MILLIS);
      }
    }
    getLogWriter().info("[testServerEventsInSystemClient] assert client detected server join");
    assertFalse(firedSystemDuplicate);
    // TODO: sometimes get adapter duplicate since memberId isn't endpoint
    // initial impl uses Endpoint.toString() for memberId of server; final
    // impl should have server send its real memberId to client via HandShake
    //assertFalse("Please update testBridgeMembershipEventsInClient to use BridgeServer memberId.",
    //           firedAdapterDuplicate);
    assertFalse(firedBridgeDuplicate);
    assertTrue(firedBridge[JOINED]);
    assertEquals(serverMember, memberBridge[JOINED]);
    assertEquals(serverMemberId, memberIdBridge[JOINED]);
    assertNotNull(memberBridge[JOINED]);
    assertNotNull(memberIdBridge[JOINED]);
    assertFalse(isClientBridge[JOINED]);
    assertFalse(firedBridge[LEFT]);
    assertNull(memberBridge[LEFT]);
    assertNull(memberIdBridge[LEFT]);
    assertFalse(isClientBridge[LEFT]);
    assertFalse(firedBridge[CRASHED]);
    assertNull(memberBridge[CRASHED]);
    assertNull(memberIdBridge[CRASHED]);
    assertFalse(isClientBridge[CRASHED]);
    resetArraysForTesting(firedBridge, memberBridge, memberIdBridge, isClientBridge);
    assertTrue(firedSystem[JOINED]);
    assertEquals(serverMember, memberSystem[JOINED]);
    assertEquals(serverMemberId, memberIdSystem[JOINED]);
    assertFalse(isClientSystem[JOINED]);
    assertFalse(firedSystem[LEFT]);
    assertNull(memberSystem[LEFT]);
    assertNull(memberIdSystem[LEFT]);
    assertFalse(isClientSystem[LEFT]);
    assertFalse(firedSystem[CRASHED]);
    assertNull(memberSystem[CRASHED]);
    assertNull(memberIdSystem[CRASHED]);
    assertFalse(isClientSystem[CRASHED]);
    resetArraysForTesting(firedSystem, memberSystem, memberIdSystem, isClientSystem);
    assertTrue(firedAdapter[JOINED]);
    assertNotNull(memberAdapter[JOINED]);
    assertNotNull(memberIdAdapter[JOINED]);
    assertEquals(serverMember, memberAdapter[JOINED]);
    assertEquals(serverMemberId, memberIdAdapter[JOINED]);
    assertFalse(isClientAdapter[JOINED]);
    assertFalse(firedAdapter[LEFT]);
    assertNull(memberAdapter[LEFT]);
    assertNull(memberIdAdapter[LEFT]);
    assertFalse(isClientAdapter[LEFT]);
    assertFalse(firedAdapter[CRASHED]);
    assertNull(memberAdapter[CRASHED]);
    assertNull(memberIdAdapter[CRASHED]);
    assertFalse(isClientAdapter[CRASHED]);
    resetArraysForTesting(firedAdapter, memberAdapter, memberIdAdapter, isClientAdapter);
    getLogWriter().info("[testServerEventsInSystemClient] wait for client to fully connect");
    final String pl =
      getRootRegion().getSubregion(name).getAttributes().getPoolName();
    PoolImpl pi = (PoolImpl)PoolManager.find(pl);
    waitForClientToFullyConnect(pi);
    LogWriter bgexecLogger =
          new LocalLogWriter(LogWriterImpl.ALL_LEVEL, System.out);
    bgexecLogger.info("<ExpectedException action=add>" + 
        "java.io.IOException" + "</ExpectedException>");
    final ExpectedException ex = addExpectedException(
        ServerConnectivityException.class.getName());
    try {
      vm0.invoke(new SerializableRunnable("Disconnect bridge server") {
        public void run() {
          getLogWriter().info("[testServerEventsInSystemClient] disconnect bridge server");
          closeCache();
          disconnectFromDS();
        }
      });
      synchronized(systemListener) {
        if (!firedSystem[LEFT]) {
          systemListener.wait(ASYNC_EVENT_WAIT_MILLIS);
        }
      }
      synchronized(adapter) {
        if (!firedAdapter[LEFT]) {
          adapter.wait(ASYNC_EVENT_WAIT_MILLIS); // KIRK: did increasing this solve problem on balrog?
        }
      }
      synchronized(bridgeListener) {
        if (!firedBridge[LEFT]) {
          bridgeListener.wait(ASYNC_EVENT_WAIT_MILLIS);
        }
      }
    }
    finally {
      bgexecLogger.info("<ExpectedException action=remove>" + 
          "java.io.IOException" + "</ExpectedException>");
      ex.remove();
    }
    getLogWriter().info("[testServerEventsInSystemClient] assert client detected server crashed");
    assertFalse(firedSystemDuplicate);
    // TODO: sometimes get adapter duplicate since memberId isn't endpoint
    // initial impl uses Endpoint.toString() for memberId of server; final
    // impl should have server send its real memberId to client via HandShake
    //assertFalse("Please update testBridgeMembershipEventsInClient to use BridgeServer memberId.",
    //           firedAdapterDuplicate);
    assertFalse(firedAdapterDuplicate);
    assertFalse(firedBridgeDuplicate);
    assertFalse(firedBridge[JOINED]);
    assertNull(memberIdBridge[JOINED]);
    assertNull(memberBridge[JOINED]);
    assertFalse(isClientBridge[JOINED]);
    assertFalse("Please update testServerEventsInSystemClient to handle memberLeft for BridgeServer.", 
                firedBridge[LEFT]);
    assertNull(memberBridge[LEFT]);
    assertNull(memberIdBridge[LEFT]);
    assertFalse(isClientBridge[LEFT]);
    assertTrue(firedBridge[CRASHED]);
    assertNotNull(memberBridge[CRASHED]);
    assertNotNull(memberIdBridge[CRASHED]);
    assertEquals(serverMemberId, memberIdBridge[CRASHED]);
    assertEquals(serverMember, memberBridge[CRASHED]);
    assertFalse(isClientBridge[CRASHED]);
    resetArraysForTesting(firedBridge, memberBridge, memberIdBridge, isClientBridge);
    assertFalse(firedSystem[JOINED]);
    assertNull(memberSystem[JOINED]);
    assertNull(memberIdSystem[JOINED]);
    assertFalse(isClientSystem[JOINED]);
    assertTrue(firedSystem[LEFT]);
    assertEquals(serverMember, memberSystem[LEFT]);
    assertEquals(serverMemberId, memberIdSystem[LEFT]);
    assertFalse(isClientSystem[LEFT]);
    assertFalse(firedSystem[CRASHED]);
    assertNull(memberSystem[CRASHED]);
    assertNull(memberIdSystem[CRASHED]);
    assertFalse(isClientSystem[CRASHED]);
    resetArraysForTesting(firedSystem, memberSystem, memberIdSystem, isClientSystem);
    assertFalse("this intermittently fails", firedAdapter[JOINED]); // KIRK --> this fails on balrog occasionally
    assertNull(memberIdAdapter[JOINED]);
    assertFalse(isClientAdapter[JOINED]);
    // LEFT fired by System listener
    assertTrue(firedAdapter[LEFT]);
    assertEquals(serverMember, memberAdapter[LEFT]);
    assertEquals(serverMemberId, memberIdAdapter[LEFT]);
    assertFalse(isClientAdapter[LEFT]);
    // There won't be an adapter crashed event because since the two VMs
    // are in the same distributed system, and the server's real member
    // id is used now. In this case, two events are sent - one from
    // jgroups (memberDeparted), and one from the server (a memberCrshed).
    // The memberCrashed event is deemed a duplicate and not sent - see 
    // UniversalMembershipListenerAdapter.SystemMembershipListener.isDuplicate
    assertFalse(firedAdapter[CRASHED]);
    assertNull(memberAdapter[CRASHED]);
    assertNull(memberIdAdapter[CRASHED]);
    assertFalse(isClientAdapter[CRASHED]);
    resetArraysForTesting(firedAdapter, memberAdapter, memberIdAdapter, isClientAdapter);
    // reconnect bridge client to test for crashed event
    vm0.invoke(createBridgeServer);
    // gather details for later creation of BridgeLoader...
    assertEquals(ports[0],
                 vm0.invokeInt(UniversalMembershipListenerAdapterDUnitTest.class, 
                               "getTestServerEventsInSystemClient_port"));
    serverMemberId = (String) vm0.invoke(
      UniversalMembershipListenerAdapterDUnitTest.class, "getMemberId");
    serverMember = (DistributedMember) vm0.invoke(
      UniversalMembershipListenerAdapterDUnitTest.class, "getDistributedMember");
    getLogWriter().info("[testServerEventsInSystemClient] ports[0]=" + ports[0]);
    getLogWriter().info("[testServerEventsInSystemClient] serverMemberId=" + serverMemberId);
    getLogWriter().info("[testServerEventsInSystemClient] serverMember=" + serverMember);
    synchronized(systemListener) {
      if (!firedSystem[JOINED]) {
        systemListener.wait(ASYNC_EVENT_WAIT_MILLIS);
      }
    }
    synchronized(adapter) {
      if (!firedAdapter[JOINED]) {
        adapter.wait(ASYNC_EVENT_WAIT_MILLIS);
      }
    }
    synchronized(bridgeListener) {
      if (!firedBridge[JOINED]) {
        bridgeListener.wait(ASYNC_EVENT_WAIT_MILLIS);
      }
    }
    getLogWriter().info("[testServerEventsInSystemClient] assert client detected server re-join");
    assertFalse(firedSystemDuplicate);
    // TODO: sometimes get adapter duplicate since memberId isn't endpoint
    // initial impl uses Endpoint.toString() for memberId of server; final
    // impl should have server send its real memberId to client via HandShake
    //assertFalse("Please update testBridgeMembershipEventsInClient to use BridgeServer memberId.",
    //           firedAdapterDuplicate);
    assertFalse(firedBridgeDuplicate);
    assertTrue(firedBridge[JOINED]);
    assertNotNull(memberBridge[JOINED]);
    assertNotNull(memberIdBridge[JOINED]);
    assertEquals(serverMember, memberBridge[JOINED]);
    assertEquals(serverMemberId, memberIdBridge[JOINED]);
    assertFalse(isClientBridge[JOINED]);
    assertFalse(firedBridge[LEFT]);
    assertNull(memberBridge[LEFT]);
    assertNull(memberIdBridge[LEFT]);
    assertFalse(isClientBridge[LEFT]);
    assertFalse(firedBridge[CRASHED]);
    assertNull(memberBridge[CRASHED]);
    assertNull(memberIdBridge[CRASHED]);
    assertFalse(isClientBridge[CRASHED]);
    resetArraysForTesting(firedBridge, memberBridge, memberIdBridge, isClientBridge);
    assertTrue(firedSystem[JOINED]);
    assertEquals(serverMember, memberSystem[JOINED]);
    assertEquals(serverMemberId, memberIdSystem[JOINED]);
    assertFalse(isClientSystem[JOINED]);
    assertFalse(firedSystem[LEFT]);
    assertNull(memberSystem[LEFT]);
    assertNull(memberIdSystem[LEFT]);
    assertFalse(isClientSystem[LEFT]);
    assertFalse(firedSystem[CRASHED]);
    assertNull(memberSystem[CRASHED]);
    assertNull(memberIdSystem[CRASHED]);
    assertFalse(isClientSystem[CRASHED]);
    resetArraysForTesting(firedSystem, memberSystem, memberIdSystem, isClientSystem);
    assertTrue(firedAdapter[JOINED]);
    assertNotNull(memberAdapter[JOINED]);
    assertNotNull(memberIdAdapter[JOINED]);
    assertEquals(serverMember, memberAdapter[JOINED]);
    assertEquals(serverMemberId, memberIdAdapter[JOINED]);
    assertFalse(isClientAdapter[JOINED]);
    assertFalse(firedAdapter[LEFT]);
    assertNull(memberAdapter[LEFT]);
    assertNull(memberIdAdapter[LEFT]);
    assertFalse(isClientAdapter[LEFT]);
    assertFalse(firedAdapter[CRASHED]);
    assertNull(memberAdapter[CRASHED]);
    assertNull(memberIdAdapter[CRASHED]);
    assertFalse(isClientAdapter[CRASHED]);
    resetArraysForTesting(firedAdapter, memberAdapter, memberIdAdapter, isClientAdapter);
  }
{ AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET) };
assertTrue(ports[0] != 0);
// getLogWriter().info("[testServerEventsInSystemClient] create bridge client");
// Properties config = new Properties();
// config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
// config.setProperty(DistributionConfig.LOCATORS_NAME, "");
// getSystem(config);
// AttributesFactory factory = new AttributesFactory();
// factory.setScope(Scope.LOCAL);
// BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, false, -1, -1, null);
// createRegion(name, factory.create());
// assertNotNull(getRootRegion().getSubregion(name));
getLogWriter().info("[testServerEventsInSystemClient] create system bridge client");
getSystem();
isClientBridge[CRASHED] = event.isClient();
notify();
}
};
final Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
final String name = this.getUniqueName();
final int[] ports = new int[]
{ AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET) };
assertTrue(ports[0] != 0);
// getLogWriter().info("[testServerEventsInSystemClient] create bridge client");
// Properties config = new Properties();
// config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
// config.setProperty(DistributionConfig.LOCATORS_NAME, "");
// getSystem(config);
// AttributesFactory factory = new AttributesFactory();
// factory.setScope(Scope.LOCAL);
// BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, false, -1, -1, null);
// createRegion(name, factory.create());
// assertNotNull(getRootRegion().getSubregion(name));
getLogWriter().info("[testServerEventsInSystemClient] create system bridge client");
getSystem();
final Properties clientProperties = getSystemProperties();
// register the bridge listener
BridgeMembership.registerBridgeMembershipListener(bridgeListener);
DistributedSystemConfig config =
AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), null);
AdminDistributedSystem adminDS =
AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
memberBridge[LEFT] = event.getMember();
memberIdBridge[LEFT] = event.getMemberId();
isClientBridge[LEFT] = event.isClient();
notify();
}
public synchronized void memberCrashed(BridgeMembershipEvent event) {
firedBridgeDuplicate[CRASHED] = firedBridge[CRASHED];
firedBridge[CRASHED] = true;
memberBridge[CRASHED] = event.getMember();
memberIdBridge[CRASHED] = event.getMemberId();
isClientBridge[CRASHED] = event.isClient();
notify();
}
};
final Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
final String name = this.getUniqueName();
final int[] ports = new int[]
{ AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET) };
assertTrue(ports[0] != 0);
// getLogWriter().info("[testServerEventsInSystemClient] create bridge client");
// Properties config = new Properties();
// config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
// config.setProperty(DistributionConfig.LOCATORS_NAME, "");
// getSystem(config);
// AttributesFactory factory = new AttributesFactory();
// factory.setScope(Scope.LOCAL);
// BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, false, -1, -1, null);
// createRegion(name, factory.create());
// assertNotNull(getRootRegion().getSubregion(name));
getLogWriter().info("[testServerEventsInSystemClient] create system bridge client");
getSystem();
final Properties clientProperties = getSystemProperties();
// register the bridge listener
BridgeMembership.registerBridgeMembershipListener(bridgeListener);
DistributedSystemConfig config =
AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), null);
AdminDistributedSystem adminDS =
AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
assertTrue(adminDS.waitToBeConnected(5 * 1000));
// register the system listener
adminDS.addMembershipListener(systemListener);
// register the universal adapter
adapter.registerMembershipListener(adminDS);
// create BridgeServer in vm0...
SerializableRunnable createBridgeServer =
new CacheSerializableRunnable("Create BridgeServer") {
@Override
public void run2() throws CacheException {