예제 #1
0
def _stub(loop):
    protocol = H2Protocol(Handler(),
                          H2Configuration(header_encoding='utf-8'),
                          loop=loop)
    channel = ChannelStub(protocol)
    request = Request('POST', 'http', '/foo/bar', authority='test.com')
    stream = Stream(channel, request, SavoysRequest, SavoysReply)
    server = ServerStub(protocol)
    return Stub(stream, server, channel)
예제 #2
0
def test_max_window_size(config):
    server_h2c = H2Connection(
        H2Configuration(client_side=False, header_encoding='ascii'))
    proto = H2Protocol(Mock(), config.__for_test__(),
                       H2Configuration(client_side=True))
    proto.connection_made(TransportStub(server_h2c))
    assert server_h2c.outbound_flow_control_window \
        == config.http2_connection_window_size
    assert server_h2c.remote_settings.initial_window_size \
        == config.http2_stream_window_size
예제 #3
0
    def __init__(self, *, loop):
        server_config = H2Configuration(client_side=False,
                                        header_encoding='utf-8')
        self.server_h2c = H2Connection(server_config)

        self.to_server_transport = TransportStub(self.server_h2c)

        client_config = H2Configuration(client_side=True,
                                        header_encoding='utf-8')
        self.client_proto = H2Protocol(client.Handler(), client_config,
                                       loop=loop)
        self.client_proto.connection_made(self.to_server_transport)
예제 #4
0
    def __init__(self, *, loop):
        client_config = H2Configuration(client_side=True,
                                        header_encoding='utf-8')
        self.client_h2c = H2Connection(client_config)

        self.to_client_transport = TransportStub(self.client_h2c)
        self.client_h2c.initiate_connection()

        server_config = H2Configuration(client_side=False,
                                        header_encoding='utf-8')
        self.server_proto = H2Protocol(DummyHandler(), server_config,
                                       loop=loop)
        self.server_proto.connection_made(self.to_client_transport)

        # complete settings exchange and clear events buffer
        self.client_flush()
        self.to_client_transport.events()
예제 #5
0
    def __init__(self):
        server_h2_config = H2Configuration(
            client_side=False,
            header_encoding='ascii',
        )
        self.server_h2c = H2Connection(server_h2_config)

        self.to_server_transport = TransportStub(self.server_h2c)

        client_h2_config = H2Configuration(
            client_side=True,
            header_encoding='ascii',
        )
        self.client_proto = H2Protocol(
            client.Handler(),
            Configuration().__for_test__(),
            client_h2_config,
        )
        self.client_proto.connection_made(self.to_server_transport)