NetworkService implements NetworkConnectionListener { @Override public void networkCameUp(final boolean silent) { if (privateChatEnabled) { udpSender.startSender(); udpReceiver.startReceiver(); } final NetworkInterface currentNetworkInterface = connectionWorker.getCurrentNetworkInterface(); messageSender.startSender(currentNetworkInterface); messageReceiver.startReceiver(currentNetworkInterface); tcpNetworkService.startService(); } NetworkService(final Controller controller, final Settings settings, final ErrorHandler errorHandler); void connect(); void disconnect(); ConnectionWorker getConnectionWorker(); boolean isConnectionWorkerAlive(); boolean isNetworkUp(); void registerNetworkConnectionListener(final NetworkConnectionListener listener); void registerMainChatMessageReceiverListener(final ReceiverListener listener); void registerPrivateChatReceiverListener(final ReceiverListener listener); boolean sendMessageToAllUsers(final String message); boolean sendMessageToUser(final String message, final User user); void checkNetwork(); @Override void networkWentDown(final boolean silent); @Override void beforeNetworkCameUp(); @Override void networkCameUp(final boolean silent);  }
@Test public void networkCameUpShouldNotFailWhenPrivateChatDisabled() { when(settings.isNoPrivateChat()).thenReturn(true); final NetworkService networkService = new NetworkService(controller, settings, errorHandler); networkService.networkCameUp(false); }