def test_send_max_descriptors(self):
   sock1, sock2 = MakeSocketPair()
   boundsock, sockaddr = naclimc.imc_makeboundsock()
   sock1.imc_sendmsg("maxdesc", tuple([sockaddr] * naclimc.DESC_MAX))
   got_data, got_socks = sock2.imc_recvmsg(100)
   self.assertEquals(got_data, "maxdesc")
   self.assertEquals(type(got_socks), tuple)
   self.assertEquals(len(got_socks), naclimc.DESC_MAX)
   for sockaddr2 in got_socks:
     new_sock1, new_sock2 = ConnectAndAccept(boundsock, sockaddr2)
     self._CheckDataMessages(new_sock1, new_sock2)
     self._CheckDataMessages(new_sock2, new_sock1)
Ejemplo n.º 2
0
 def test_send_max_descriptors(self):
     sock1, sock2 = MakeSocketPair()
     boundsock, sockaddr = naclimc.imc_makeboundsock()
     sock1.imc_sendmsg("maxdesc", tuple([sockaddr] * naclimc.DESC_MAX))
     got_data, got_socks = sock2.imc_recvmsg(100)
     self.assertEquals(got_data, "maxdesc")
     self.assertEquals(type(got_socks), tuple)
     self.assertEquals(len(got_socks), naclimc.DESC_MAX)
     for sockaddr2 in got_socks:
         new_sock1, new_sock2 = ConnectAndAccept(boundsock, sockaddr2)
         self._CheckDataMessages(new_sock1, new_sock2)
         self._CheckDataMessages(new_sock2, new_sock1)
 def test_send_recv_descriptor(self):
   sock1, sock2 = MakeSocketPair()
   boundsock, sockaddr = naclimc.imc_makeboundsock()
   sock1.imc_sendmsg("desc", tuple([sockaddr]))
   got_data, got_socks = sock2.imc_recvmsg(100)
   self.assertEquals(got_data, "desc")
   self.assertEquals(type(got_socks), tuple)
   self.assertEquals(len(got_socks), 1)
   sockaddr2 = got_socks[0]
   new_sock1, new_sock2 = ConnectAndAccept(boundsock, sockaddr2)
   self._CheckDataMessages(new_sock1, new_sock2)
   self._CheckDataMessages(new_sock2, new_sock1)
Ejemplo n.º 4
0
 def test_send_recv_descriptor(self):
     sock1, sock2 = MakeSocketPair()
     boundsock, sockaddr = naclimc.imc_makeboundsock()
     sock1.imc_sendmsg("desc", tuple([sockaddr]))
     got_data, got_socks = sock2.imc_recvmsg(100)
     self.assertEquals(got_data, "desc")
     self.assertEquals(type(got_socks), tuple)
     self.assertEquals(len(got_socks), 1)
     sockaddr2 = got_socks[0]
     new_sock1, new_sock2 = ConnectAndAccept(boundsock, sockaddr2)
     self._CheckDataMessages(new_sock1, new_sock2)
     self._CheckDataMessages(new_sock2, new_sock1)
def MakeSocketPair():
  boundsock, sockaddr = naclimc.imc_makeboundsock()
  return ConnectAndAccept(boundsock, sockaddr)
 def test_send_too_many_descriptors(self):
   sock = MakeSocketPair()[0]
   boundsock, sockaddr = naclimc.imc_makeboundsock()
   descs = tuple([sockaddr] * (naclimc.DESC_MAX + 1))
   self.assertRaises(Exception, lambda: sock.imc_sendmsg("msg data", descs))
Ejemplo n.º 7
0
def MakeSocketPair():
    boundsock, sockaddr = naclimc.imc_makeboundsock()
    return ConnectAndAccept(boundsock, sockaddr)
Ejemplo n.º 8
0
 def test_send_too_many_descriptors(self):
     sock = MakeSocketPair()[0]
     boundsock, sockaddr = naclimc.imc_makeboundsock()
     descs = tuple([sockaddr] * (naclimc.DESC_MAX + 1))
     self.assertRaises(Exception,
                       lambda: sock.imc_sendmsg("msg data", descs))