code: private void open(String host, int port, SocketFactory fact, int conTimeout) throws ApiConnectionException {
          try {
              InetAddress ia = InetAddress.getByName(host.trim());
              sock = fact.createSocket();
              sock.connect(new InetSocketAddress(ia, port), conTimeout);
              in = new DataInputStream(sock.getInputStream());
              out = new DataOutputStream(sock.getOutputStream());
              connected = true;
              reader = new Reader();
              reader.setDaemon(true);
              reader.start();
              processor = new Processor();
              processor.setDaemon(true);
              processor.start();
          } catch (UnknownHostException ex) {
              connected = false;
              throw new ApiConnectionException(String.format("Unknown host '%s'", host), ex);
          } catch (IOException ex) {
              connected = false;
              throw new ApiConnectionException(String.format("Error connecting to %s:%d : %s", host, port, ex.getMessage()), ex);
          }
      }
docs: Start the API. Connects to the Mikrotik