@Override
    public Iterable<DiscoveryNode> discoverNodes() {
        try {
            List<GcpAddress> gcpAddresses = gcpClient.getAddresses();
            logGcpAddresses(gcpAddresses);

            List<DiscoveryNode> result = new ArrayList<>();
            for (GcpAddress gcpAddress : gcpAddresses) {
                for (int port = portRange.getFromPort(); port <= portRange.getToPort(); port++) {
                    result.add(createDiscoveryNode(gcpAddress, port));
                }
            }

            return result;
        } catch (Exception e) {
            LOGGER.warning("Cannot discover nodes, returning empty list", e);
            return Collections.emptyList();
        }
    }
@Test
    public void discoverNodes() {
        // given
        GcpAddress gcpInstance1 = new GcpAddress("192.168.1.15", "38.146.24.2");
        GcpAddress gcpInstance2 = new GcpAddress("192.168.1.16", "38.146.28.15");
        given(gcpClient.getAddresses()).willReturn(asList(gcpInstance1, gcpInstance2));

        // when
        Iterable<DiscoveryNode> nodes = gcpDiscoveryStrategy.discoverNodes();

        // then
        Iterator<DiscoveryNode> iter = nodes.iterator();

        DiscoveryNode node1 = iter.next();
        assertEquals(gcpInstance1.getPrivateAddress(), node1.getPrivateAddress().getHost());
        assertEquals(gcpInstance1.getPublicAddress(), node1.getPublicAddress().getHost());
        assertEquals(PORT1, node1.getPrivateAddress().getPort());

        DiscoveryNode node2 = iter.next();
        assertEquals(gcpInstance1.getPrivateAddress(), node2.getPrivateAddress().getHost());
        assertEquals(gcpInstance1.getPublicAddress(), node2.getPublicAddress().getHost());
        assertEquals(PORT2, node2.getPrivateAddress().getPort());

        DiscoveryNode node3 = iter.next();
        assertEquals(gcpInstance2.getPrivateAddress(), node3.getPrivateAddress().getHost());
        assertEquals(gcpInstance2.getPublicAddress(), node3.getPublicAddress().getHost());
        assertEquals(PORT1, node3.getPrivateAddress().getPort());

        DiscoveryNode node4 = iter.next();
        assertEquals(gcpInstance2.getPrivateAddress(), node4.getPrivateAddress().getHost());
        assertEquals(gcpInstance2.getPublicAddress(), node4.getPublicAddress().getHost());
        assertEquals(PORT2, node4.getPrivateAddress().getPort());
    }