public void sendMyProxyAddress() throws IOException {
    outputStream = socket.getOutputStream();
    OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
    out = new BufferedWriter(outputStreamWriter);

    JsonObject jsonObject = new JsonObject();
    jsonObject
        .withKeyValue("msgtype", ModelCloudProxy.class.getSimpleName())
        .withKeyValue("hostName", modelCloud.getHostName())
        .withKeyValue("portNo", modelCloud.getAcceptPort());

    String message = jsonObject.toString();

    out.write(message + "\n");
    out.flush();

    proxy.setState("online");
  }
  public void sendFile(String string, long lastModified, byte[] allBytes) {
    JsonObject jsonObject = new JsonObject();
    jsonObject
        .withKeyValue("msgtype", "fileTransfer")
        .withKeyValue("fileName", string)
        .withKeyValue("fileSize", allBytes.length)
        .withKeyValue("lastModified", lastModified);

    String message = jsonObject.toString();

    try {
      out.write(message + "\n");
      out.flush();
      outputStream.write(allBytes);
      outputStream.flush();
      out.write("There might be a problem with file end, thus I send some garbage here. \n\n\n");
      out.flush();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }