@Test public void testWhenClientSendsKillThenCommandHandlerShouldKillGepard() throws IOException { given(gepardServerSocketFactory.create(1)).willReturn(serverSocket); given(serverSocket.accept()).willReturn(socket); given(socket.getInputStream()).willReturn(inputStream); given(socket.getOutputStream()).willReturn(outputStream); inputStream = new ByteArrayInputStream("kill\n".getBytes()); given(socket.getInputStream()).willReturn(inputStream); underTest.run(); verify(killCommandHandler).handleCommand(); }
@Override public void run() { Util util = new Util(); String me = this.getName(); isInitialized = tryInitiateService(); running = true; if (isInitialized) { while (running) { receiveData(util); try { sleep(sleepTime); } catch (InterruptedException e) { LOGGER.debug("Thread: " + me + " is exiting, as got InterruptedException!"); return; } } } }
RemoteControlHandlerThread extends Thread { @Override public void run() { Util util = new Util(); String me = this.getName(); isInitialized = tryInitiateService(); running = true; if (isInitialized) { while (running) { receiveData(util); try { sleep(sleepTime); } catch (InterruptedException e) { LOGGER.debug("Thread: " + me + " is exiting, as got InterruptedException!"); return; } } } } }
RemoteControlHandlerThread extends Thread { @Override public void run() { Util util = new Util(); String me = this.getName(); isInitialized = tryInitiateService(); running = true; if (isInitialized) { while (running) { receiveData(util); try { sleep(sleepTime); } catch (InterruptedException e) { LOGGER.debug("Thread: " + me + " is exiting, as got InterruptedException!"); return; } } } } RemoteControlHandlerThread(final RemoteControlHandler handler, final ServerSocketFactory serverSocketFactory, final int gepardPort); }
RemoteControlHandlerThread extends Thread { @Override public void run() { Util util = new Util(); String me = this.getName(); isInitialized = tryInitiateService(); running = true; if (isInitialized) { while (running) { receiveData(util); try { sleep(sleepTime); } catch (InterruptedException e) { LOGGER.debug("Thread: " + me + " is exiting, as got InterruptedException!"); return; } } } } RemoteControlHandlerThread(final RemoteControlHandler handler, final ServerSocketFactory serverSocketFactory, final int gepardPort); @Override void run(); void setSleepTime(final long sleepTime); }
RemoteControlHandlerThread extends Thread { @Override public void run() { Util util = new Util(); String me = this.getName(); isInitialized = tryInitiateService(); running = true; if (isInitialized) { while (running) { receiveData(util); try { sleep(sleepTime); } catch (InterruptedException e) { LOGGER.debug("Thread: " + me + " is exiting, as got InterruptedException!"); return; } } } } RemoteControlHandlerThread(final RemoteControlHandler handler, final ServerSocketFactory serverSocketFactory, final int gepardPort); @Override void run(); void setSleepTime(final long sleepTime);  }