Example #1
0
 public override void Run()
 {
     try
     {
         DomainSocket client             = DomainSocket.Connect(TestPath);
         OutputStream clientOutputStream = client.GetOutputStream();
         InputStream  clientInputStream  = client.GetInputStream();
         clientOutputStream.Write(clientMsg1);
         DomainSocket      domainConn = (DomainSocket)client;
         byte[]            in1        = new byte[serverMsg1.Length];
         FileInputStream[] recvFis    = new FileInputStream[passedFds.Length];
         int r = domainConn.RecvFileInputStreams(recvFis, in1, 0, in1.Length - 1);
         Assert.True(r > 0);
         IOUtils.ReadFully(clientInputStream, in1, r, in1.Length - r);
         Assert.True(Arrays.Equals(serverMsg1, in1));
         for (int i = 0; i < passedFds.Length; i++)
         {
             NUnit.Framework.Assert.IsNotNull(recvFis[i]);
             passedFiles[i].CheckInputStream(recvFis[i]);
         }
         foreach (FileInputStream fis in recvFis)
         {
             fis.Close();
         }
         client.Close();
     }
     catch (System.Exception e)
     {
         threadResults.AddItem(e);
     }
     threadResults.AddItem(new TestDomainSocket.Success());
 }