public void execute(final PyDebugCallback<T> callback) {
    final int sequence = myDebugger.getNextSequence();

    final ResponseProcessor<T> processor = getResponseProcessor();

    if (processor != null) {
      myDebugger.placeResponse(sequence, null);
    }

    try {
      ProtocolFrame frame = new ProtocolFrame(myCommandCode, sequence, getPayload());
      boolean frameSent = myDebugger.sendFrame(frame);

      if (processor == null) return;

      if (!frameSent) {
        throw new PyDebuggerException("Couldn't send frame " + myCommandCode);
      }
    }
    catch (PyDebuggerException e) {
      callback.error(e);
      return;
    }

    ApplicationManager.getApplication().executeOnPooledThread(() -> {
      try {
        ProtocolFrame frame = myDebugger.waitForResponse(sequence, getResponseTimeout());
        if (frame == null) {
          if (!myDebugger.isConnected()) {
            throw new PyDebuggerException("No connection (command:  " + myCommandCode + " )");
          }
          throw new PyDebuggerException("Timeout waiting for response on " + myCommandCode);
        }
        T exception_occurred = processor.parseException(frame);
        if (exception_occurred != null && exception_occurred.equals("True")) {
          callback.error(new PyDebuggerException("Exception occurred"));
        } else {
          callback.ok(processor.processResponse(frame));
        }
      }
      catch (PyDebuggerException e) {
        callback.error(e);
      }
    });
  }
public void execute(final PyDebugCallback<T> callback)