Skip to content

Instantly share code, notes, and snippets.

@tempire
Created May 25, 2012 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tempire/2789727 to your computer and use it in GitHub Desktop.
Save tempire/2789727 to your computer and use it in GitHub Desktop.
my $ioloop = Mojo::IOLoop->singleton;
my $daemon = Mojo::Server::Daemon->new(app => app, ioloop => $ioloop);
my $port = Mojo::IOLoop->generate_port;
$daemon->listen(
[ "https://127.0.0.1:$port"
. '?cert=t/certs/server.crt'
. '&key=t/certs/server.key'
. '&ca=t/certs/ca.crt'
]
)->start;
## Success - expected common name
my $ua = Mojo::UserAgent->new(
ioloop => $ioloop,
cert => 't/certs/client.crt',
key => 't/certs/client.key'
);
my $t = Test::Mojo->new(app => app, ua => $ua);
$t->get_ok("https://127.0.0.1:$port")->status_is(200)->content_is('ok');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment