public void messageReceived(String message) {
if (browser == null) {
int browserId = Integer.parseInt(message);
browser = browserSource.getBrowserById(browserId);
} else if (message.equals(END_XML)) {
BrowserResult result = new BrowserResultBuilder().build(xmlString);
listener.browserTestRunFinished(browser, result);
} else if (message.trim().length() > 0) {
xmlString += message;
xmlString += "\n";
}