def test_5_misc(self):
        logging.debug('')
        logging.debug('test_misc')

        factory = self.start_factory()

        # Try using a server after being released, server never used before.
        # This usually results in a "Can't connect" error, but sometimes gets a
        # "Can't send" error, based on timing/proxying.
        server = factory.create('')
        factory.release(server)
        msg1 = "Can't connect to server at"
        msg2 = "Can't send to server at"
        try:
            reply = server.echo('hello')
        except RuntimeError as exc:
            if str(exc)[:len(msg1)] != msg1 and str(exc)[:len(msg2)] != msg2:
                self.fail('Expected connect/send error, got %r' % exc)
        else:
            self.fail('Expected RuntimeError')

        # Try using a server after being released, server has been used before.
        # This usually results in a "Can't send" error, but sometimes gets a
        # "Can't connect" error, based on timing/proxying.
        server = factory.create('')
        reply = server.echo('hello')
        factory.release(server)
        msg1 = "Can't send to server at"
        msg2 = "Can't connect to server at"
        try:
            reply = server.echo('hello')
        except RuntimeError as exc:
            if str(exc)[:len(msg1)] != msg1 and str(exc)[:len(msg2)] != msg2:
                self.fail('Expected send/connect error, got %r' % exc)
        except EOFError: # this can happen when testing concurrently
            pass
        else:
            self.fail('Expected RuntimeError')

        # Try releasing a server twice. Depending on timing, this could
        # result in a ValueError trying to identify the server to release or
        # a RemoteError where the request can't be unpacked. The timing seems
        # to be sensitive to AF_INET/AF_UNIX connection type.
        server = factory.create('')
        factory.release(server)
        msg1 = "can't identify server "
        msg2 = "RuntimeError: Can't decrypt/unpack request." \
               " This could be the result of referring to a dead server."
        try:
            factory.release(server)
        except ValueError as exc:
            self.assertEqual(str(exc)[:len(msg1)], msg1)
        except RemoteError as exc:
            self.assertTrue(msg2 in str(exc))
        else:
            self.fail('Expected ValueError or RemoteError')

        # Check false return of has_interface().
        self.assertFalse(has_interface(factory, HasObjectives))

        # Try to connect to wrong port (assuming junk_port isn't being used!)
        address = socket.gethostname()
        junk_port = 12345
        assert_raises(self, 'connect(address, junk_port, pubkey=self.key)',
                      globals(), locals(), RuntimeError, "Can't connect to ")

        # Unpickleable argument.
        code = compile('3 + 4', '<string>', 'eval')
        assert_raises(self, 'factory.echo(code)', globals(), locals(),
                      cPickle.PicklingError, "Can't pickle <type 'code'>")

        # Server startup failure.
        assert_raises(self, 'self.start_factory(port=0, allowed_users={})',
                      globals(), locals(), RuntimeError,
                      'Server startup failed')
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_distsim.py/TestCase.test_5_misc/original