code: public void init() {
          WfdLog.d(TAG, "Called init()");
  
          initAndStartHandler();
  
          try {
              mPort = this.requestAvailablePortFromOs();
          } catch (IOException e) {
              mListener.onError();
              return;
          }
  
          mManager = (WifiP2pManager) mContext.getSystemService(Context.WIFI_P2P_SERVICE);
          mChannel = mManager.initialize(mContext, Looper.getMainLooper(), new WifiP2pManager.ChannelListener() {
              @Override
              public void onChannelDisconnected() {
                  WfdLog.d(TAG, "Channel disconnected");
              }
          });
  
          mReceiver.register(mContext);
          NineBus.get().register(this);
      }
docs: Method called by {@link WFDMiddlewareAdapter#connect()}