title: Use Network SocketFactory with SSL
body: <p>I'm trying to reach my server from WiFi or Mobile Data, depending on which interface is answering. The use case is the following :
  - WiFi is always on.
  - If the server is not responding through the WiFi (because there is no internet connection for example), then I redirect future requests to the cellular data.
  - When the connection is back through the WiFi, I redirect next requests to the WiFi.</p>
  
  <p>To achieve this, I wanted to use the ConnectivityManager with TRANSPORT_CELLULAR or TRANSPORT_WIFI. Then it returns a Network object which I can use.</p>
  
  <p>After that I planned to pass the socketFactory from the Network class to the OkHttpClient.</p>
  
  <pre><code>OkHttpClient client = new OkHttpClient.Builder()
          .socketFactory(network.getSocketFactory())
          .build();
  </code></pre>
  
  <p>Problem : the server uses a https connection. So I'm building the OkHttpClient using socketSSLFactory, which is build with SSLContext and its method getSocketFactory.</p>
  
  <p>So the question is the following : how can I bind the OkHttpClient to a Network AND to a SSL Socket Factory ?</p>