@Override
  public void sendMessage(IMessage message) {
    if (m_outStream == null) {
      throw new IllegalStateException("Trying to send a message on a shutdown sender");
    }
    if (writer == null) {
      try {
        writer =
            new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(m_outStream, "UTF-8")), // $NON-NLS-1$
                false /* autoflush */);
      } catch (UnsupportedEncodingException e1) {
        writer =
            new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(m_outStream)), false /* autoflush */);
      }
    }

    String msg = ((IStringMessage) message).getMessageAsString();
    if (RemoteTestNG.isVerbose()) {
      p("Sending message:" + message);
      p("  String version:" + msg);

      StringBuffer buf = new StringBuffer();
      for (int i = 0; i < msg.length(); i++) {
        if ('\u0001' == msg.charAt(i)) {
          p("  word:[" + buf.toString() + "]");
          buf.delete(0, buf.length());
        } else {
          buf.append(msg.charAt(i));
        }
      }
      p("  word:[" + buf.toString() + "]");
    }

    synchronized (m_ackLock) {
      writer.println(msg);
      writer.flush();
      waitForAck();
    }
  }
 private static void p(String msg) {
   if (RemoteTestNG.isVerbose()) {
     System.out.println("[StringMessageSender] " + msg); // $NON-NLS-1$
   }
 }
 protected void handleThrowable(Throwable cause) {
   if (RemoteTestNG.isVerbose()) {
     cause.printStackTrace();
   }
 }