Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Debugging with SSL on localhost using Android #381

Answered by fileman
henda79 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,
you can use SSL on Android emulator, but you have to create a DelegatingHandler like this:

    public class AndroidEmulatorHandler : DelegatingHandler
    {
        protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            HttpMessageHandler handler = this.InnerHandler;

            while (handler is DelegatingHandler)
            {
                handler = ((DelegatingHandler)handler).InnerHandler;
            }
#if DEBUG
            if (handler is HttpClientHandler httpClientHandler
                && httpClientHandler.ServerCertificateCustomValidationCallback == null)
            {
          …

Replies: 1 comment 13 replies

Comment options

You must be logged in to vote
13 replies
@henda79
Comment options

@adrianhall
Comment options

@henda79
Comment options

@xiiihopeestheim
Comment options

@henda79
Comment options

Answer selected by henda79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants