Getting a NoNodeAvailableException when using elasticsearch Java

I've recently upgraded to elasticsearch 2.0, I am running an elasticsearch 2.0 server and the jar is 2.0 too. But when I try to run the following code I am getting a NoNodeAvailableException

boolean hasIndex = client.admin().indices().exists(new IndicesExistsRequest(INDEX)).actionGet().isExists();

Here is my Transport Client builder also:

Settings settings = Settings.settingsBuilder().put("cluster.name", "elasticsearch").build(); client = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

Also, the cluster name is definitely elasticsearch in the elasticsearch.yml file.

Here is the stack trace:

<05-Nov-15 17:04:04> NoNodeAvailableException[None of the configured nodes are available: []]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:280)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:272)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:336)
at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1172)
at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.exists(AbstractClient.java:1192)
at com.mumsnet.elasticsearch.index.CreateElasticSearchIndex.indexExists(CreateElasticSearchIndex.java:223)

Dan