Skip to content

Commit

Permalink
more tests for keep alive connection timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 6, 2013
1 parent abd72f8 commit 153460f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion t/mojo/user_agent.t
Expand Up @@ -276,7 +276,9 @@ ok !$tx->success, 'not successful';
is $tx->error, 'Inactivity timeout', 'right error';

# Keep alive connection times out
my $id;
my ($fail, $id);
my $error = $ua->on(error => sub { $fail++ });
ok $ua->has_subscribers('error'), 'has subscribers';
$ua->get(
'/' => sub {
my ($ua, $tx) = @_;
Expand All @@ -286,7 +288,10 @@ $ua->get(
}
);
Mojo::IOLoop->start;
ok !$fail, 'error event has not been emitted';
ok !Mojo::IOLoop->stream($id), 'connection timed out';
$ua->unsubscribe(error => $error);
ok !$ua->has_subscribers('error'), 'unsubscribed successfully';

# Response exceeding message size limit
$ua->once(
Expand Down

0 comments on commit 153460f

Please sign in to comment.