// Path: remote/src/main/java/org/testng/remote/RemoteTestNG.java
// public static boolean isVerbose() {
//     boolean result = System.getProperty(PROPERTY_VERBOSE) != null || isDebug();
//     return result;
// }


import static org.testng.remote.RemoteTestNG.isVerbose;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
      reader.beginObject();

      String name = reader.nextName();
      if (!"type".equals(name)) {
        throw new IOException("type node first");
      }

      int msgType = reader.nextInt();
      MessageType type = MessageType.fromValue(msgType);
      if (type == null) {
        throw new IOException("unknown message type: " + msgType + ", raw json: " + jsonMsg);
      }

      name = reader.nextName();
      if (!"data".equals(name)) {
        throw new IOException("data node then");
      }

      Gson gson = new GsonBuilder().create();
      IMessage message = null;
      switch (type) {
      case GENERIC:
        message = gson.fromJson(reader, GenericMessage.class);
        break;
      case SUITE:
        message = gson.fromJson(reader, SuiteMessage.class);
        break;
      case TEST:
        message = gson.fromJson(reader, TestMessage.class);
        break;
// Path: remote/src/main/java/org/testng/remote/RemoteTestNG.java
// public static boolean isVerbose() {
//     boolean result = System.getProperty(PROPERTY_VERBOSE) != null || isDebug();
//     return result;
// }


// Path: remote/src/main/java/org/testng/remote/strprotocol/JsonMessageSender.java
import static org.testng.remote.RemoteTestNG.isVerbose;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

      reader.beginObject();

      String name = reader.nextName();
      if (!"type".equals(name)) {
        throw new IOException("type node first");
      }

      int msgType = reader.nextInt();
      MessageType type = MessageType.fromValue(msgType);
      if (type == null) {
        throw new IOException("unknown message type: " + msgType + ", raw json: " + jsonMsg);
      }

      name = reader.nextName();
      if (!"data".equals(name)) {
        throw new IOException("data node then");
      }

      Gson gson = new GsonBuilder().create();
      IMessage message = null;
      switch (type) {
      case GENERIC:
        message = gson.fromJson(reader, GenericMessage.class);
        break;
      case SUITE:
        message = gson.fromJson(reader, SuiteMessage.class);
        break;
      case TEST:
        message = gson.fromJson(reader, TestMessage.class);
        break;
      case TEST_RESULT: