@Override
    public Optional<SimpleAddress> selectAddress(Optional<String> addressSelectionContext)
    {
        if (addressSelectionContext.isPresent()) {
            return addressSelectionContext
                    .map(HostAndPort::fromString)
                    .map(SimpleAddress::new);
        }
        List<HostAndPort> catalogServers = internalNodeManager.getCatalogServers().stream()
                .filter(node -> node.getThriftPort().isPresent())
                .map(catalogServerNode -> {
                    HostAddress hostAndPort = catalogServerNode.getHostAndPort();
                    return HostAndPort.fromParts(hostAndPort.getHostText(), catalogServerNode.getThriftPort().getAsInt());
                })
                .collect(toImmutableList());
        return hostSelector.apply(catalogServers).map(SimpleAddress::new);
    }
@Test(expectedExceptions = IllegalArgumentException.class)
    public void testAddressSelectionContextPresentWithInvalidAddress()
    {
        InMemoryNodeManager internalNodeManager = new InMemoryNodeManager();
        RandomCatalogServerAddressSelector selector = new RandomCatalogServerAddressSelector(internalNodeManager);

        selector.selectAddress(Optional.of("host:123.456"));
    }