1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use FindBin qw($Bin);
use lib "$Bin/lib";
use Carp qw(croak);
use MemcachedTest;
use IO::Socket qw(AF_INET SOCK_STREAM);
use IO::Select;
if (!supports_proxy()) {
plan skip_all => 'proxy not enabled';
exit 0;
}
# Set up the listeners _before_ starting the proxy.
# the fourth listener is only occasionally used.
my $t = Memcached::ProxyTest->new(servers => [12111]);
my $p_srv = new_memcached('-o proxy_config=./t/proxyconfigmulti1.lua:./t/proxyconfigmulti2.lua -t 1');
my $ps = $p_srv->sock;
$ps->autoflush(1);
$t->set_c($ps);
$t->accept_backends();
$t->c_send("mg foo\r\n");
$t->be_recv_c(0);
$t->be_send(0, "HD\r\n");
$t->c_recv_be();
done_testing();
|