/* Get the state of the specified node. */
public NodeState getNodeState()
throws IOException, ServiceConnectFailedException {
BinaryNodeStateProtocol protocol =
new BinaryNodeStateProtocol(NameIdPair.NOCHECK, null);
SocketChannel channel = null;
try {
/* Build the connection. */
channel = RepUtils.openBlockingChannel(socketAddress,
true,
socketTimeout);
ServiceDispatcher.doServiceHandshake
(channel, BinaryNodeStateService.SERVICE_NAME);
/* Send a NodeState request to the node. */
protocol.write
(protocol.new BinaryNodeStateRequest(nodeName, groupName),
channel);
/* Get the response and return the NodeState. */
BinaryNodeStateResponse response =
protocol.read(channel, BinaryNodeStateResponse.class);
return response.convertToNodeState();
} finally {
if (channel != null) {
channel.close();