### Question:
NodeUtil { public static Map<String, Object> getZookeeperStatus() throws IOException { String[] connections = Config.getBlurConfig().get("blur.zookeeper.connection").split(","); Set<String> onlineZookeepers = new HashSet<String>(); Set<String> offlineZookeepers = new HashSet<String>(); for (String connection : connections) { Socket socket = null; InputStream response = null; OutputStream question = null; try { URI parsedConnection = new URI("my: String host = parsedConnection.getHost(); int port = parsedConnection.getPort() >= 0 ? parsedConnection.getPort() : 2181; byte[] reqBytes = new byte[4]; ByteBuffer req = ByteBuffer.wrap(reqBytes); req.putInt(ByteBuffer.wrap("ruok".getBytes()).getInt()); socket = new Socket(); socket.setSoLinger(false, 10); socket.setSoTimeout(20000); parsedConnection.getPort(); socket.connect(new InetSocketAddress(host, port)); response = socket.getInputStream(); question = socket.getOutputStream(); question.write(reqBytes); byte[] resBytes = new byte[4]; response.read(resBytes); String status = new String(resBytes); if (status.equals("imok")) { onlineZookeepers.add(connection); } else { offlineZookeepers.add(connection); } socket.close(); response.close(); question.close(); } catch (Exception e) { offlineZookeepers.add(connection); } finally { if (socket != null) { socket.close(); } if (response != null) { response.close(); } if (question != null) { question.close(); } } } Map<String, Object> data = new HashMap<String, Object>(); data.put("online", onlineZookeepers); data.put("offline", offlineZookeepers); return data; }  static Map<String, Object> getControllerStatus(); static Collection<String> subtract(final Collection<String> a, final Collection<String> b); @SuppressWarnings("unchecked") static List<Map<String, Object>> getClusterStatus(); static Map<String, Object> getZookeeperStatus();  }### Answer:
@SuppressWarnings("unchecked") @Test public void testGetZookeeperStatus() throws BlurException, IOException, TException { Map<String, Object> nodeStatus = NodeUtil.getZookeeperStatus(); assertEquals(0, ((HashSet<String>) nodeStatus.get("online")).size()); assertEquals(1, ((HashSet<String>) nodeStatus.get("offline")).size()); }