DebuggerSession (final RemoteConnection remoteConnection, final boolean pollConnection) { RemoteState remoteState = new RemoteStateState(myProject, remoteConnection); ExecutionEnvironment environment = new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance()) .runProfile(new MockConfiguration(myProject)) .build(); DebuggerSession debuggerSession = null; try { debuggerSession = attachVirtualMachine(remoteState, environment, remoteConnection, pollConnection); } catch (ExecutionException e) { fail(e.getMessage()); } debuggerSession.getProcess().getProcessHandler().addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { print(event.getText(), outputType); } }); return debuggerSession; }