Codota Logo
OnDeviceSocketServer
Code IndexAdd Codota to your IDE (free)

How to use
OnDeviceSocketServer
in
com.musala.atmosphere.commons.ad.socket

Best Java code snippets using com.musala.atmosphere.commons.ad.socket.OnDeviceSocketServer (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: com.musala.atmosphere/atmosphere-agent-device-lib

/**
 * Initializes and starts the network thread.
 * 
 * @throws IOException
 *         - if network thread initialization fails
 */
public void start() throws IOException {
  if (!isNetworkThreadRunning()) {
    socketServerThread = new Thread(connectionHandler);
    socketServerThread.start();
    LOGGER.info("Started network thread.");
  } else {
    LOGGER.error("Network thread start requested, but it's already running.");
  }
}
origin: com.musala.atmosphere/atmosphere-uiautomator-bridge

@Override
public Object handle(Object[] args) {
  isRunning = false;
  if (socketServer != null) {
    synchronized (socketServer) {
      if (socketServer != null) {
        socketServer.terminate();
      }
    }
  }
  return UIAutomatorRequest.VOID_RESPONSE;
}
origin: com.musala.atmosphere/atmosphere-uiautomator-bridge

/**
 * Main entry point being called when the UI automator process is started.
 */
public void testRun() {
  Log4JConfigurator.configure();
  AccessibilityHelper accessibilityHelper = AccessibilityFactory.getAccessibilityHelper();
  accessibilityHelper.initializeAccessibilityEventListener();
  try {
    socketServer = new OnDeviceSocketServer<UIAutomatorRequest>(this, ConnectionConstants.UI_AUTOMATOR_PORT);
    socketServer.start();
    isRunning = true;
    LOGGER.info("Automator socket server started successfully.");
  } catch (IOException e) {
    LOGGER.error("Could not start ATMOSPHERE socket server", e);
  }
  while (isRunning) {
    try {
      Thread.sleep(SLEEP_TIEMOUT);
    } catch (InterruptedException e) {
      // Nothing to do here
    }
  }
}
origin: com.musala.atmosphere/atmosphere-agent-device-lib

  /**
   * Terminates the work of the socket server.
   */
  public void terminate() {
    if (!isNetworkThreadRunning()) {
      LOGGER.warn("Could not terminate network thread. Network thread is not running.");
      return;
    }

    LOGGER.info("Stopping socket server...");
    connectionHandler.terminate();

    try {
      socketServerThread.join(SOCKET_THREAD_KILL_TIMEOUT);
      LOGGER.debug("Network thread should be stopped now...");
    } catch (InterruptedException e) {
      LOGGER.debug("Error stopping network thread...", e);
    }

    try {
      connectionHandler.terminateSocketServer();
      LOGGER.info("Socket connection stopped successfully!");
    } catch (IOException e) {
      LOGGER.error("Could not close opened connection.", e);
    }
  }
}
com.musala.atmosphere.commons.ad.socketOnDeviceSocketServer

Javadoc

A socket server that listens for sockets requests by the Agent, forwards them to a RequestHandler and returns its response back to the Agent.

Most used methods

  • <init>
    Creates an object that can start a socket server on the given port in a new thread. The socket serve
  • isNetworkThreadRunning
    Checks whether the network thread is initialized and running.
  • start
    Initializes and starts the network thread.
  • terminate
    Terminates the work of the socket server.

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • addToBackStack (FragmentTransaction)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Notification (javax.management)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now