public void runDemo(boolean initiatorMode, String preferredTerminalName) throws IOException {
TerminalMode terminalMode = initiatorMode ? TerminalMode.INITIATOR : TerminalMode.TARGET;
Terminal terminal = TerminalUtils.getAvailableTerminal(preferredTerminalName);
System.out.println("Using: " + terminal.getTerminalName());
NfcAdapter nfcAdapter = new NfcAdapter(terminal, terminalMode);
nfcAdapter.setNfcipConnectionListener(llcpOverNfcip);
nfcAdapter.startListening();
System.out.println("Mode: " + terminalMode);
System.out.println("Waiting for P2P, press ENTER to exit");
System.in.read();
}