O host do Native Messaging tentou enviar uma mensagem com 977472013 bytes de comprimento

Estou usando um jar java para enviar e receber mensagens usando o Chrome Native Messaging.

Ativei o log do Chrome para poder lerC:\Users\%UserName%\AppData\Local\Google\Chrome\User Data\chrome_debug.log Arquivo

Na verdade, não consigo enviar ou receber mensagens com meu aplicativo Java, mas sei que ele é usado.

Aqui está o manifesto do meu anfitrião:

{
   "allowed_origins" : 
    [ 
        "chrome-extension://EXTENSION-ID/" 
    ],
   "description" : "my.app",
   "name" : "my.app",
   "path" : "launch.bat",
   "type" : "stdio"
}

Aqui está o conteúdo do arquivo em lote launch.bat:

java -jar "%~dp0ChromeSEOConnector.jar"

E aqui está o meu código Java:

private String readMessage(InputStream in) throws IOException {
        byte[] b = new byte[4];
        in.read(b);

        int size = getInt(b);

        b = new byte[size];
        in.read(b);

        return new String(b, "UTF-8");
    }

private void sendMessage(String message) throws IOException {
        Text text = new Text(message);
        String resposta = serializer.toJson(text);
        System.out.write(getBytes(resposta.length()));
        System.out.write(resposta.getBytes("UTF-8"));
        System.out.flush();
    }

public int getInt(byte[] bytes) {
        return (bytes[3] << 24) & 0xff000000 |
                (bytes[2] << 16) & 0x00ff0000 |
                (bytes[1] << 8) & 0x0000ff00 |
                (bytes[0] << 0) & 0x000000ff;
    }

 public byte[] getBytes(int length) {
        byte[] bytes = new byte[4];
        bytes[0] = (byte) (length & 0xFF);
        bytes[1] = (byte) ((length >> 8) & 0xFF);
        bytes[2] = (byte) ((length >> 16) & 0xFF);
        bytes[3] = (byte) ((length >> 24) & 0xFF);
        return bytes;
    }

Parece que o System.in nunca recebe a entrada do meu aplicativo e o System.out nunca envia dados também.

O Chrome continua recebendo o mesmo erro:

Native Messaging host tried sending a message that is 977472013 bytes long.

O estranho é que o tamanho da mensagem é sempre o mesmo, mesmo que eu mude manualmente o tamanho da mensagem enviada, como se a mensagem não tivesse sido analisada. Você encontrou esse tipo de erro? desde já, obrigado

questionAnswers(2)

yourAnswerToTheQuestion