While I agree with @mdeora, I am attempting to explain (long way) what happens behind the scene in simple terms, and hope it will help.
Lets define few terms first
Client ("C"): a Mobile Application which uses SSL/TLS library. Also, Client may be configured to recognize certificates signed by an internal Certifying Authority (CA).
Server ("S"): a target server which serves the request
Proxy ("P") or Transparent proxy ("TP"): Which intercepts the SSL request, and presents an illusion to Client that it is indeed a target server, by sending a certificate on behalf of "S", but signed by an internal CA certificate created by proxy server. E.g. Burp Suite, Squid
DNS Servers: A service which resolves a name to IP address
Client DNS servers: One or more IP addresses of DNS server configured on mobile, either due to explicit configuration, or supplied by network connection when mobile device connects to network (telecom or Wifi)
Proxy DNS servers: One or more IP addresses of DNS servers configured on same machine where proxy service is configured
Case A. When neither proxy, nor transparent proxy present between the Client and the Server
- "C" finds an IP address (say "IP-S") of "S" by querying a Client DNS server.
- "C" uses SSL/TLS to connect to "IP-S" and completes the communication. Entire communication is encrypted.
In this case, Burp Suite / Wireshark cannot see a plain text traffic.
Case B. When a mobile is configured to use a proxy server "P"
- "C" finds an IP address of "P" by querying Client DNS server, say "IP-P".
- "C" connects to "IP-P" via HTTP or HTTPS protocol.
- If "C" connects to "P" via HTTP protocol, "P" intercepts the request, checks the URL, and gets a domain name.
- If "C" connects to "P" via HTTPS protocol, "P" will understand the target server name as part of SSL/TLS handshake via SNI -- an extension to
SSL/TLS. (https://en.wikipedia.org/wiki/Server_Name_Indication)
- "P" will use a Proxy DNS server to get IP (say "IP-S") for "S". "P" will connect to "IP-S".
- Under a normal case, "P" (or "TP") would relay byte-by-byte request from "C" to "S" and response from "S" to "C". "C" will always get a real certificate of "S", and "P"/"TP" would not know anything beyond the fact that "C" is communicating with "S".
- However, in case of interceptors (e.g. BurpSuite), "P" (or "TP") will present a certificate signed by internal CA, impersonating "S". If "C" is configured to recognize certificates signed by internal CA, SSL library within "C" will be compelled to assume that it is indeed talking to "S".
Without SSL pinning, "C" will interact with "P" (or "TP") as if it is "S". "P" will decrypt the traffic, and establish a connection with "S", re-encrypt the traffic and sends it to "S". Same way, "P" will receive response from "S", and sends it back to "C". "C" and "S", both, will be unaware of the fact that "P" has intercepted (and may have altered) the traffic.
With SSL pinning (https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Pinning_Cheat_Sheet.md), "C" will not proceed if it finds that certificate presented by "P"/"TP" does not match a real certificate of "S".
Case C. When a mobile is using a network where Transparent Proxy ("TP") is present
Here, "C" attempts to connect to "S" as in Case A, but "TP" present in the network intercepts the traffic just like "P" and rest is followed as Case B(4) onward.
To summarize, when you use SSL Pinning, "C" will communicate to "S" only if it believes that it is communicating over a secure channel to real "S", not a proxy.