Upstream commit of Android SNI / NPN fix

https://android-review.googlesource.com/#/c/111211

The change's to Android's Platform have been ported.

This does not include the introduction of PlatformTest,
which will be difficult to write so it works everywhere.
Merge pull request #1137 from nfuller/OptionalMethod

Upstream commit of Android SNI / NPN fix