Esempio n. 1
0
 def setUp(self):
     if options.http_path:
         self.transport = THttpClient.THttpClient(options.host,
                                                  port=options.port,
                                                  path=options.http_path)
     else:
         if options.ssl:
             from thrift.transport import TSSLSocket
             socket = TSSLSocket.TSSLSocket(options.host,
                                            options.port,
                                            validate=False)
         else:
             socket = TSocket.TSocket(options.host, options.port)
         # frame or buffer depending upon args
         if options.framed:
             self.transport = TTransport.TFramedTransport(socket)
         else:
             self.transport = TTransport.TBufferedTransport(socket)
         if options.zlib:
             self.transport = TZlibTransport.TZlibTransport(
                 self.transport, 9)
     self.transport.open()
     protocol = self.protocol_factory.getProtocol(self.transport)
     if options.multiple:
         p = TMultiplexedProtocol.TMultiplexedProtocol(
             protocol, "ThriftTest")
         self.client = ThriftTest.Client(p)
         p = TMultiplexedProtocol.TMultiplexedProtocol(
             protocol, "SecondService")
         self.client2 = SecondService.Client(p)
     else:
         self.client = ThriftTest.Client(protocol)
         self.client2 = None
Esempio n. 2
0
    def setUp(self):
        if self.ssl:
            self.socket = TSSLSocket.TSSLSocket("localhost", self._port)
        else:
            self.socket = TSocket.TSocket("localhost", self._port)

        if self.server_type in FRAMED_TYPES \
                and not isinstance(self, HeaderTest):
            self.transport = TTransport.TFramedTransport(self.socket)
        else:
            self.transport = TTransport.TBufferedTransport(self.socket)

        self.protocol = self.protocol_factory.getProtocol(self.transport)
        if isinstance(self, HeaderAcceleratedCompactTest):
            self.protocol.trans.set_protocol_id(
                THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
            self.protocol.reset_protocol()
        self.transport.open()
        self.client = ThriftTest.Client(self.protocol)
        if self.multiple:
            p = TMultiplexedProtocol.TMultiplexedProtocol(
                self.protocol, "ThriftTest")
            self.client = ThriftTest.Client(p)
            p = TMultiplexedProtocol.TMultiplexedProtocol(
                self.protocol, "SecondService")
            self.client2 = SecondService.Client(p)
        else:
            self.client = ThriftTest.Client(self.protocol)
            self.client2 = None
Esempio n. 3
0
    def setUp(self):
        if options.http_path:
            self.transport = THttpClient.THttpClient(
                options.host, options.port, options.http_path)
        else:
            socket = TSocket.TSocket(options.host, options.port)

            # frame or buffer depending upon args
            if options.framed:
                self.transport = TTransport.TFramedTransport(socket)
            else:
                self.transport = TTransport.TBufferedTransport(socket)

        protocol = self.protocol_factory.getProtocol(self.transport)
        if options.header:
            protocol = THeaderProtocol.THeaderProtocol(socket)
            self.transport = protocol.trans
            protocol.trans.add_transform(protocol.trans.ZLIB_TRANSFORM)

        self.transport.open()
        self.client = ThriftTest.Client(protocol)
        if options.multiple:
            p = TMultiplexedProtocol.TMultiplexedProtocol(protocol,
                    "ThriftTest")
            self.client = ThriftTest.Client(p)
            p = TMultiplexedProtocol.TMultiplexedProtocol(protocol,
                    "SecondService")
            self.client2 = SecondService.Client(p)
        else:
            self.client = ThriftTest.Client(protocol)
            self.client2 = None