@Test
  void testFromEnodeWithDiscoveryDisabled() throws UnknownHostException {
    EnodeURL enodeWithNoDiscovery = mock(EnodeURL.class);
    when(enodeWithNoDiscovery.getDiscoveryPort()).thenReturn(Optional.empty());
    when(enodeWithNoDiscovery.getListeningPort()).thenReturn(Optional.of(8545));

    when(enodeWithNoDiscovery.getIp()).thenReturn(InetAddress.getLoopbackAddress());

    Endpoint result = Endpoint.fromEnode(enodeWithNoDiscovery);

    assertEquals("127.0.0.1", result.getHost());

    assertEquals(EnodeURLImpl.DEFAULT_LISTENING_PORT, result.getUdpPort());

    assertEquals(Optional.empty(), result.getTcpPort());
  }
These tests simulates the case where a node crashes then comes back up with a new ip address or
listening port.
ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgentTest.java