@Test public void exceptionIsThrown_whenPortIsOutOfRange() throws Exception { final String host = "127.0.0.1"; final int port = 65536; final AgentServerStatusListener serverStatusListener = mock(AgentServerStatusListener.class); final AgentConnectionServer server = new AgentConnectionServer(host, port, 100, TimeUnit.MILLISECONDS); server.addStatusListener(serverStatusListener); assertThatIllegalArgumentException().isThrownBy(server::start); }
public void addStatusListener(final AgentServerStatusListener listener) { listeners.add(listener); }
AgentConnectionServer { public void addStatusListener(final AgentServerStatusListener listener) { listeners.add(listener); } }
AgentConnectionServer { public void addStatusListener(final AgentServerStatusListener listener) { listeners.add(listener); } AgentConnectionServer(final String host, final int port);  AgentConnectionServer(final String host, final int port, final int timeout, final TimeUnit timeoutUnit); }
AgentConnectionServer { public void addStatusListener(final AgentServerStatusListener listener) { listeners.add(listener); } AgentConnectionServer(final String host, final int port);  AgentConnectionServer(final String host, final int port, final int timeout, final TimeUnit timeoutUnit); static final int findFreePort(); void addStatusListener(final AgentServerStatusListener listener); void removeStatusListener(final AgentServerStatusListener listener); void start(final RobotAgentEventListener... eventsListeners); void waitForServerToSetup(); void stop(); }
AgentConnectionServer { public void addStatusListener(final AgentServerStatusListener listener) { listeners.add(listener); } AgentConnectionServer(final String host, final int port);  AgentConnectionServer(final String host, final int port, final int timeout, final TimeUnit timeoutUnit); static final int findFreePort(); void addStatusListener(final AgentServerStatusListener listener); void removeStatusListener(final AgentServerStatusListener listener); void start(final RobotAgentEventListener... eventsListeners); void waitForServerToSetup(); void stop(); static final int RED_AGENT_PROTOCOL_VERSION; static final String DEFAULT_CONNECTION_HOST; static final int DEFAULT_CONNECTION_PORT; static final int DEFAULT_CONNECTION_TIMEOUT; static final int MIN_CONNECTION_PORT; static final int MIN_CONNECTION_TIMEOUT; static final int MAX_CONNECTION_PORT; static final int MAX_CONNECTION_TIMEOUT; }