@Test public void testNotify_BIP72_Single() throws Exception { serverSocket = new ServerSocket( ExternalDataListeningService.MULTIBIT_HD_NETWORK_SOCKET, 10, InetAddress.getLoopbackAddress() ); String[] args = new String[]{ PAYMENT_REQUEST_BIP72_URL_SINGLE }; testObject = new ExternalDataListeningService(args); testObject.start(); Socket client = serverSocket.accept(); String text; try (InputStreamReader reader = new InputStreamReader(client.getInputStream(), Charsets.UTF_8)) { text = CharStreams.toString(reader); } client.close(); String expectedMessage = ExternalDataListeningService.MESSAGE_START + PAYMENT_REQUEST_BIP72_URL_SINGLE + ExternalDataListeningService.MESSAGE_END; assertThat(text).isEqualTo(expectedMessage); CoreEvents.fireShutdownEvent(ShutdownEvent.ShutdownType.SOFT); assertThat(testObject.getServerSocket().isPresent()).isFalse(); }
Optional<ServerSocket> getServerSocket() { return serverSocket; }
ExternalDataListeningService extends AbstractService { Optional<ServerSocket> getServerSocket() { return serverSocket; } }
ExternalDataListeningService extends AbstractService { Optional<ServerSocket> getServerSocket() { return serverSocket; } ExternalDataListeningService(String[] args); }
ExternalDataListeningService extends AbstractService { Optional<ServerSocket> getServerSocket() { return serverSocket; } ExternalDataListeningService(String[] args); @Override boolean startInternal(); static synchronized void writeToSocket(String message); Queue<AlertModel> getAlertModelQueue(); static void parseRawData(String rawData); static synchronized void purgeAlertModelQueue(); }
ExternalDataListeningService extends AbstractService { Optional<ServerSocket> getServerSocket() { return serverSocket; } ExternalDataListeningService(String[] args); @Override boolean startInternal(); static synchronized void writeToSocket(String message); Queue<AlertModel> getAlertModelQueue(); static void parseRawData(String rawData); static synchronized void purgeAlertModelQueue(); static final int MULTIBIT_HD_NETWORK_SOCKET; static final String MESSAGE_START; static final String MESSAGE_END; }