Ejemplo n.º 1
0
 @Override
 public RemoteControl listenOn(int port, IOCallback ioCallback) throws IOException {
   final ExecutorService executorService = handler.getExecutorService(ASyncType.SOCKET_LISTEN);
   final ExecutorService executorServiceConnect =
       handler.getExecutorService(ASyncType.SOCKET_LISTEN_CONNECT);
   final ServerSocket serverSocket = socketFactory.createServerSocket(port, address);
   ListenOnRun listenOnRun =
       new ListenOnRun(executorServiceConnect, serverSocket, ioCallback, exceptionCallback);
   executorService.execute(listenOnRun);
   return listenOnRun;
 }
Ejemplo n.º 2
0
 @Override
 public void connectTo(String host, int port, IOCallback callback) throws IOException {
   final ExecutorService executorService = handler.getExecutorService(ASyncType.SOCKET_CONNECT);
   executorService.execute(
       new ConncetToRun(socketFactory.createSocket(host, port), callback, exceptionCallback));
 }