GatewayReceiverMBeanBridge extends ServerBridge { public String[] getConnectedGatewaySenders() { Acceptor acceptor = getReceiverServer().getAcceptor(); Set<ServerConnection> serverConnections = acceptor.getAllServerConnections(); if (serverConnections == null || serverConnections.isEmpty()) { return new String[0]; } return serverConnections.stream().map(ServerConnection::getMembershipID).toArray(String[]::new); } @VisibleForTesting  GatewayReceiverMBeanBridge(GatewayReceiver gatewayReceiver); @Override int getClientConnectionCount(); @Override void stopMonitor(); void addGatewayReceiverStats(GatewayReceiverStats stats); String getBindAddress(); int getPort(); int getSocketBufferSize(); boolean isRunning(); void start(); void stop(); int getEndPort(); String[] getGatewayTransportFilters(); int getStartPort(); int getMaximumTimeBetweenPings(); float getCreateRequestsRate(); float getDestroyRequestsRate(); int getDuplicateBatchesReceived(); int getOutoforderBatchesReceived(); float getUpdateRequestsRate(); float getEventsReceivedRate(); String[] getConnectedGatewaySenders();  }
@Test public void getConnectedGatewaySenders() { when(acceptor.getAllServerConnections()).thenReturn(null); assertThat(bridge.getConnectedGatewaySenders()).isNotNull().hasSize(0); when(acceptor.getAllServerConnections()).thenReturn(Collections.emptySet()); assertThat(bridge.getConnectedGatewaySenders()).isNotNull().hasSize(0); ServerConnection connection = mock(ServerConnection.class); when(connection.getMembershipID()).thenReturn("testId"); when(acceptor.getAllServerConnections()).thenReturn(Collections.singleton(connection)); assertThat(bridge.getConnectedGatewaySenders()).containsExactly("testId"); }