No node available problem

I am a beginer of the elasticsearch. I came across the No node available problem and did not know how to slove it. I have set up a node in my computer and closed the firewall.

My code of the TransportClient:
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", clusterName).put("client.transport.sniff", true).build();
client = new TransportClient(settings).addTransportAddress(
new InetSocketTransportAddress("localhost", 9200));

SearchResponse response = client.prepareSearch("goods")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(textQuery).setFrom(0).setSize(60).setExplain(true)
.execute().actionGet();

The error message:
Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: No node available
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:170)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:97)
at org.elasticsearch.client.support.AbstractClient.search(AbstractClient.java:206)
at org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:345)
at org.elasticsearch.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:743)
at org.elasticsearch.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:53)
at org.elasticsearch.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:47)
at searchengine.SearchEngine.searchByKeyWords(SearchEngine.java:66)
at searchengine.EngineClient.main(EngineClient.java:18)