@Override
    public Network network() {
        return network;
    }
@Test
    public void getAltNetworkUsingList() {
        // An alternative network
        NetworkParameters altNetParams = new MockAltNetworkParams();

        // Create a parser that knows about the new network (this does not modify global state)
        List<Network> nets = new ArrayList<>(DefaultAddressParserProvider.DEFAULT_NETWORKS_LEGACY);
        nets.add(altNetParams.network());
        AddressParser customParser = new DefaultAddressParserProvider(DefaultAddressParserProvider.DEFAULT_NETWORKS_SEGWIT, nets).forKnownNetworks();

        // Unfortunately for NetworkParameters.of() to work properly we still have to modify gobal state
        Networks.register(altNetParams);
        try {

            // Check if can parse address
            Address altAddress = customParser.parseAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6");
            assertEquals(altNetParams.getId(), altAddress.network().id());

            // Check if main network works with custom parser
            Address mainAddress = customParser.parseAddress("17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");
            assertEquals(MAINNET.id(), mainAddress.network().id());

        } finally {
            // Unregister network. Do this in a finally block so other tests don't fail if the try block fails to complete
            Networks.unregister(altNetParams);
        }

        try {
            AddressParser.getLegacy().parseAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6");
            fail();
        } catch (AddressFormatException e) { }
    }