title: WebRTC disconnects after reconnecting (Android)
body: <p>Everything works fine but when I turn off my wifi and turn it on again, the WebRTC session is reconnected but after 6-7 seconds it goes to disconnected state and then failed state.</p>
  <p>Logs</p>
  <pre><code>2020-09-19 19:34:27.112 5941-6059/com.thirdeyegen.mr_workspacee D/NEW_WEBRTC_STATE==&gt;: CHECKING
  2020-09-19 19:34:28.338 5941-6059/com.thirdeyegen.mr_workspacee D/NEW_WEBRTC_STATE==&gt;: CONNECTED
  2020-09-19 19:35:06.133 5941-6059/com.thirdeyegen.mr_workspacee D/NEW_WEBRTC_STATE==&gt;: DISCONNECTED
  2020-09-19 19:35:06.473 5941-6059/com.thirdeyegen.mr_workspacee D/NEW_WEBRTC_STATE==&gt;: CONNECTED
  2020-09-19 19:35:21.363 5941-6059/com.thirdeyegen.mr_workspacee D/NEW_WEBRTC_STATE==&gt;: DISCONNECTED
  2020-09-19 19:35:31.379 5941-6059/com.thirdeyegen.mr_workspacee D/NEW_WEBRTC_STATE==&gt;: FAILED
  </code></pre>
  <p>Event 1, 2 initial session (Works fine)
  Event 3, 4, 5, 6 Series of events when I turn off wifi and connect again.
  On event 4 everything is working but 5, 6 happens after 6-7 seconds.</p>
  <p>My code</p>
  <pre><code>public PeerConnection createLocalPeerConnection() {
      final List&lt;PeerConnection.IceServer&gt; iceServers = new ArrayList&lt;&gt;();
      PeerConnection.IceServer iceServer = PeerConnection.IceServer
              .builder(&quot;turn:&quot; + turnUrl)
              .setUsername(turnUsername)
              .setPassword(turnPassword)
              .createIceServer();
      iceServers.add(iceServer);
  
      PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
      rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.ENABLED;
      rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE;
      rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;
      rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;
      rtcConfig.keyType = PeerConnection.KeyType.ECDSA;
      rtcConfig.enableDtlsSrtp = true;
      rtcConfig.enableRtpDataChannel = true;
      rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
  
      return peerConnectionFactory.createPeerConnection(rtcConfig, new CustomPeerConnectionObserver(&quot;local&quot;) {
          @Override
          public void onIceCandidate(IceCandidate iceCandidate) {
              super.onIceCandidate(iceCandidate);
              websocket.onIceCandidate(iceCandidate, localParticipant.getConnectionId());
          }
  
          @Override
          public void onSignalingChange(PeerConnection.SignalingState signalingState) {
              super.onSignalingChange(signalingState);
          }
  
          @Override
          public void onIceConnectionChange(PeerConnection.IceConnectionState iceConnectionState) {
              if (iceConnectionState.name().toLowerCase().equals(&quot;connected&quot;)) {
                  isLocalConnected = true;
              }
              Log.d(&quot;NEW_WEBRTC_STATE==&gt;&quot;, iceConnectionState.name());
  
              if (iceConnectionState.equals(PeerConnection.IceConnectionState.FAILED)) {
                 checkForInternetAndReconnect();
              } else if (iceConnectionState.equals(PeerConnection.IceConnectionState.DISCONNECTED)) {
                  activity.showConnectingAnimation(View.VISIBLE);
              } else {
                  activity.showConnectingAnimation(View.GONE);
              }
              super.onIceConnectionChange(iceConnectionState);
          }
  
      });
  }
  </code></pre>
  <p>P.S. I'm using code from OpenVidu android repository.</p>