use of com.google.security.zynamics.binnavi.Debug.Debugger.MockEventListener in project binnavi by google.
the class CAbstractConnectionTest method reconnect.
@Test
public void reconnect() throws DebugExceptionWrapper {
// This test makes sure that consecutive runs of the debugger still receive messages
final DebugCommand command = new DebugCommand(DebugCommandType.RESP_INFO, 0);
command.addArgument(new DebugMessageRawArgument("<info><registers></registers><size>32</size><options></options></info>".getBytes()));
final MockDebugger debugger = new MockDebugger(new byte[][] { "NAVI".getBytes(), command.toByteArray() });
final MockEventListener listener = new MockEventListener();
debugger.addListener(listener);
debugger.connect();
debugger.connection.m_reader.next();
debugger.connection.m_reader.next();
debugger.close();
assertEquals("RECEIVED_TARGET_INFORMATION;", listener.events);
debugger.connect();
debugger.connection.m_reader.next();
debugger.connection.m_reader.next();
debugger.close();
assertEquals("RECEIVED_TARGET_INFORMATION;RECEIVED_TARGET_INFORMATION;", listener.events);
}
Aggregations