NoNodeAvailableException when connecting from Java

We have a 2.3.3 cluster which works fine from Python. I need to connect to it from Java but am clearly doing something wrong. My code to create the client is

    Settings settings = Settings.settingsBuilder().put("client.transport.sniff", true).put("cluster.name", "foo").build();
    Client client = new TransportClient.Builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("host", 9300)));

The host name is correct and "foo" is configured as the cluster name in the yml. When I try to do anything with the Client object I get

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{1.2.3.4}{host/1.2.3.4:9300}]]
        at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)

The actual IP address in the error is correct, as is the host name.

I saw some StackOverflow posts which suggested adding network:publish_host and network:bind_host lines to the yml - they had no effect.

The ES log says

[transport ] [foo-1] publish_address {host/1.2.3.4:9300}, bound_addresses {1.2.3.4:9300}

Any ideas?

May be a firewall issue?
Can you telnet on port 9300 from the machine where the Java client runs?

It was not supposed to be blocked, but apparently it is. That was simple. Thanks!