private static void sendInput(String input, Charset charset, OutputStream outputStream) throws IOException {
    byte[] bytes = input.getBytes(charset);
    int length = bytes.length;
    byte[] packet = new byte[length + 4];
    System.arraycopy(bytes, 0, packet, 4, length);
    packet[0] = (byte)(length >> 24);
    packet[1] = (byte)(length >> 16);
    packet[2] = (byte)(length >> 8);
    packet[3] = (byte)length;
    outputStream.write(packet);
    outputStream.flush();
  }
private static void sendInput(String input, Charset charset, OutputStream outputStream)