### Question:
FourLetterWordMain { public static String send4LetterWord(String host, int port, String cmd) throws IOException { return send4LetterWord(host, port, cmd, DEFAULT_SOCKET_TIMEOUT); } private  FourLetterWordMain(); static String send4LetterWord(String host, int port, String cmd); static String send4LetterWord(String host, int port, String cmd, int timeout);  }### Answer:
@Test public void testNullCmd() { cmd = null; try { testResult = FourLetterWordMain .send4LetterWord(localHost, zkPort, cmd); } catch (Exception e) { testResult = e.getMessage(); } logger.info("testNullCmd result: " + testResult); assertEquals("cmd must not be null", testResult); }
@Test public void testSocketTimeOut() { cmd = "test socket time out"; try { doThrow(new SocketTimeoutException()) .when(socket) .connect(any(InetSocketAddress.class), Mockito.anyInt()); testResult = FourLetterWordMain .send4LetterWord(localHost, zkPort, cmd); } catch (Exception e) { testResult = e.getMessage(); } logger.info("testSocketTimeOut result: " + testResult); assertEquals( "Exception while executing four letter word: " + cmd, testResult ); }