@Override public void execute() throws MojoExecutionException, MojoFailureException { if (skipTests) { getLog().info("Hadoop Unit's embedded-stop goal is skipped"); } else { getLog().info("is going to send a hadoop unit stop message"); try (Socket client = new Socket("localhost", port); PrintWriter out = new PrintWriter(client.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()))) { client.setSoTimeout(timeout); out.println("stop"); String responseLine; if ((responseLine = in.readLine()) != null) { if (StringUtils.containsIgnoreCase(responseLine, "success")) { getLog().info("hadoop unit is stopped"); } } } catch (IOException e) { getLog().error("unable to contact pre-integration phase: " + e.getMessage()); } } } }