public static void reply()

in core/src/main/java/com/jetbrains/sa/jdwp/JDWPProxy.java [57:98]


    public static void reply(Connection connection, com.jetbrains.sa.jdi.VirtualMachineImpl vm) throws IOException {
        VirtualMachineImpl virtualMachine = new VirtualMachineImpl(connection, vm);

//        sendVMStart(virtualMachine);

        try {
            while (true) {
                byte[] b = connection.readPacket();
                Packet p = Packet.fromByteArray(b);
                int cmdSet = p.cmdSet;
                int cmd = p.cmd;
                PacketStream packetStream = new PacketStream(virtualMachine, p.id, cmdSet, cmd);
                Command command = COMMANDS.get(cmdSet).get(cmd);
                try {
                    command.reply(virtualMachine, packetStream, new PacketStream(virtualMachine, p));
                } catch (VMDisconnectedException vde) {
                    throw  vde;
                } catch (Throwable e) {
                    e.printStackTrace();
                    packetStream.pkt.errorCode = JDWP.Error.INTERNAL;
                    packetStream.dataStream.reset();

                    // serialize the original exception as a utf8 string
                    try {
                        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
                        PrintStream printStream = new PrintStream(byteStream, false, "UTF8");
                        e.printStackTrace(printStream);
                        printStream.write(vm.name().getBytes("UTF-8")); // append jvm name in the end
                        printStream.close();
                        packetStream.writeString(byteStream.toString("UTF8"));
                    } catch (Exception ignored) {
                    }
                }
                packetStream.send();
            }
        } catch (VMDisconnectedException ignored) {
        } finally {
            connection.close();
            //todo: dispose breaks subsequent connections, need to investigate
            vm.dispose();
        }
    }