blob: 1e906fe24d0e3ef99741655d0e8876f270c07bb7 [file] [log] [blame]
mikescarlettcd0e4752016-02-08 17:35:47 -08001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "webrtc/p2p/quic/quicsession.h"
12
kwiberg3ec46792016-04-27 07:22:53 -070013#include <memory>
mikescarlettcd0e4752016-02-08 17:35:47 -080014#include <string>
15#include <vector>
16
17#include "net/base/ip_endpoint.h"
18#include "net/quic/crypto/crypto_server_config_protobuf.h"
mikescarlettcd0e4752016-02-08 17:35:47 -080019#include "net/quic/crypto/proof_source.h"
20#include "net/quic/crypto/proof_verifier.h"
21#include "net/quic/crypto/quic_crypto_client_config.h"
22#include "net/quic/crypto/quic_crypto_server_config.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020023#include "net/quic/crypto/quic_random.h"
mikescarlettcd0e4752016-02-08 17:35:47 -080024#include "net/quic/quic_crypto_client_stream.h"
25#include "net/quic/quic_crypto_server_stream.h"
mikescarlettcd0e4752016-02-08 17:35:47 -080026#include "webrtc/p2p/base/faketransportcontroller.h"
27#include "webrtc/p2p/quic/quicconnectionhelper.h"
28#include "webrtc/p2p/quic/reliablequicstream.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020029#include "webrtc/rtc_base/gunit.h"
mikescarlettcd0e4752016-02-08 17:35:47 -080030
mikescarlettf5377682016-03-29 12:14:55 -070031using net::IPAddress;
mikescarlettcd0e4752016-02-08 17:35:47 -080032using net::IPEndPoint;
mikescarlettf5377682016-03-29 12:14:55 -070033using net::PerPacketOptions;
mikescarlettcd0e4752016-02-08 17:35:47 -080034using net::Perspective;
35using net::ProofVerifyContext;
36using net::ProofVerifyDetails;
37using net::QuicByteCount;
38using net::QuicClock;
mikescarlett8d37d292016-04-29 15:35:00 -070039using net::QuicCompressedCertsCache;
mikescarlettcd0e4752016-02-08 17:35:47 -080040using net::QuicConfig;
41using net::QuicConnection;
42using net::QuicCryptoClientConfig;
43using net::QuicCryptoServerConfig;
44using net::QuicCryptoClientStream;
45using net::QuicCryptoServerStream;
46using net::QuicCryptoStream;
47using net::QuicErrorCode;
48using net::QuicPacketWriter;
49using net::QuicRandom;
50using net::QuicServerConfigProtobuf;
51using net::QuicServerId;
52using net::QuicStreamId;
53using net::WriteResult;
54using net::WriteStatus;
55
56using cricket::FakeTransportChannel;
57using cricket::QuicConnectionHelper;
58using cricket::QuicSession;
59using cricket::ReliableQuicStream;
60using cricket::TransportChannel;
61
62using rtc::Thread;
63
64// Timeout for running asynchronous operations within unit tests.
mikescarlettf5377682016-03-29 12:14:55 -070065static const int kTimeoutMs = 1000;
mikescarlettcd0e4752016-02-08 17:35:47 -080066// Testing SpdyPriority value for creating outgoing ReliableQuicStream.
mikescarlettf5377682016-03-29 12:14:55 -070067static const uint8_t kDefaultPriority = 3;
mikescarlettcd0e4752016-02-08 17:35:47 -080068// TExport keying material function
mikescarlettf5377682016-03-29 12:14:55 -070069static const char kExporterLabel[] = "label";
70static const char kExporterContext[] = "context";
71static const size_t kExporterContextLen = sizeof(kExporterContext);
mikescarlettcd0e4752016-02-08 17:35:47 -080072// Identifies QUIC server session
mikescarlettf5377682016-03-29 12:14:55 -070073static const QuicServerId kServerId("www.google.com", 443);
mikescarlettcd0e4752016-02-08 17:35:47 -080074
75// Used by QuicCryptoServerConfig to provide server credentials, returning a
76// canned response equal to |success|.
77class FakeProofSource : public net::ProofSource {
78 public:
79 explicit FakeProofSource(bool success) : success_(success) {}
80
81 // ProofSource override.
mikescarlettf5377682016-03-29 12:14:55 -070082 bool GetProof(const IPAddress& server_ip,
mikescarlettcd0e4752016-02-08 17:35:47 -080083 const std::string& hostname,
84 const std::string& server_config,
mikescarlettf5377682016-03-29 12:14:55 -070085 net::QuicVersion quic_version,
86 base::StringPiece chlo_hash,
mikescarlettcd0e4752016-02-08 17:35:47 -080087 bool ecdsa_ok,
mikescarlettf5377682016-03-29 12:14:55 -070088 scoped_refptr<net::ProofSource::Chain>* out_certs,
mikescarlettcd0e4752016-02-08 17:35:47 -080089 std::string* out_signature,
90 std::string* out_leaf_cert_sct) override {
91 if (success_) {
mikescarlettf5377682016-03-29 12:14:55 -070092 std::vector<std::string> certs;
93 certs.push_back("Required to establish handshake");
94 *out_certs = new ProofSource::Chain(certs);
95 *out_signature = "Signature";
96 *out_leaf_cert_sct = "Time";
mikescarlettcd0e4752016-02-08 17:35:47 -080097 }
98 return success_;
99 }
100
101 private:
102 // Whether or not obtaining proof source succeeds.
103 bool success_;
104};
105
106// Used by QuicCryptoClientConfig to verify server credentials, returning a
107// canned response of QUIC_SUCCESS if |success| is true.
108class FakeProofVerifier : public net::ProofVerifier {
109 public:
110 explicit FakeProofVerifier(bool success) : success_(success) {}
111
112 // ProofVerifier override
113 net::QuicAsyncStatus VerifyProof(
114 const std::string& hostname,
mikescarlett8d37d292016-04-29 15:35:00 -0700115 const uint16_t port,
mikescarlettcd0e4752016-02-08 17:35:47 -0800116 const std::string& server_config,
mikescarlett8d37d292016-04-29 15:35:00 -0700117 net::QuicVersion quic_version,
118 base::StringPiece chlo_hash,
mikescarlettcd0e4752016-02-08 17:35:47 -0800119 const std::vector<std::string>& certs,
120 const std::string& cert_sct,
121 const std::string& signature,
mikescarlett8d37d292016-04-29 15:35:00 -0700122 const ProofVerifyContext* context,
mikescarlettcd0e4752016-02-08 17:35:47 -0800123 std::string* error_details,
kwiberg3ec46792016-04-27 07:22:53 -0700124 std::unique_ptr<net::ProofVerifyDetails>* verify_details,
mikescarlettcd0e4752016-02-08 17:35:47 -0800125 net::ProofVerifierCallback* callback) override {
126 return success_ ? net::QUIC_SUCCESS : net::QUIC_FAILURE;
127 }
128
129 private:
130 // Whether or not proof verification succeeds.
131 bool success_;
132};
133
134// Writes QUIC packets to a fake transport channel that simulates a network.
135class FakeQuicPacketWriter : public QuicPacketWriter {
136 public:
137 explicit FakeQuicPacketWriter(FakeTransportChannel* fake_channel)
138 : fake_channel_(fake_channel) {}
139
140 // Sends packets across the network.
141 WriteResult WritePacket(const char* buffer,
142 size_t buf_len,
mikescarlettf5377682016-03-29 12:14:55 -0700143 const IPAddress& self_address,
144 const IPEndPoint& peer_address,
145 PerPacketOptions* options) override {
mikescarlettcd0e4752016-02-08 17:35:47 -0800146 rtc::PacketOptions packet_options;
147 int rv = fake_channel_->SendPacket(buffer, buf_len, packet_options, 0);
148 net::WriteStatus status;
149 if (rv > 0) {
150 status = net::WRITE_STATUS_OK;
151 } else if (fake_channel_->GetError() == EWOULDBLOCK) {
152 status = net::WRITE_STATUS_BLOCKED;
153 } else {
154 status = net::WRITE_STATUS_ERROR;
155 }
156 return net::WriteResult(status, rv);
157 }
158
159 // Returns true if the writer buffers and subsequently rewrites data
160 // when an attempt to write results in the underlying socket becoming
161 // write blocked.
162 bool IsWriteBlockedDataBuffered() const override { return true; }
163
164 // Returns true if the network socket is not writable.
165 bool IsWriteBlocked() const override { return !fake_channel_->writable(); }
166
167 // Records that the socket has become writable, for example when an EPOLLOUT
168 // is received or an asynchronous write completes.
169 void SetWritable() override { fake_channel_->SetWritable(true); }
170
171 // Returns the maximum size of the packet which can be written using this
172 // writer for the supplied peer address. This size may actually exceed the
173 // size of a valid QUIC packet.
174 QuicByteCount GetMaxPacketSize(
175 const IPEndPoint& peer_address) const override {
176 return net::kMaxPacketSize;
177 }
178
179 private:
180 FakeTransportChannel* fake_channel_;
181};
182
mikescarlettcd0e4752016-02-08 17:35:47 -0800183// Wrapper for QuicSession and transport channel that stores incoming data.
184class QuicSessionForTest : public QuicSession {
185 public:
kwiberg3ec46792016-04-27 07:22:53 -0700186 QuicSessionForTest(std::unique_ptr<net::QuicConnection> connection,
mikescarlettcd0e4752016-02-08 17:35:47 -0800187 const net::QuicConfig& config,
kwiberg3ec46792016-04-27 07:22:53 -0700188 std::unique_ptr<FakeTransportChannel> channel)
mikescarlettcd0e4752016-02-08 17:35:47 -0800189 : QuicSession(std::move(connection), config),
190 channel_(std::move(channel)) {
191 channel_->SignalReadPacket.connect(
192 this, &QuicSessionForTest::OnChannelReadPacket);
193 }
194
195 // Called when channel has packets to read.
196 void OnChannelReadPacket(TransportChannel* channel,
197 const char* data,
198 size_t size,
199 const rtc::PacketTime& packet_time,
200 int flags) {
201 OnReadPacket(data, size);
202 }
203
204 // Called when peer receives incoming stream from another peer.
205 void OnIncomingStream(ReliableQuicStream* stream) {
206 stream->SignalDataReceived.connect(this,
207 &QuicSessionForTest::OnDataReceived);
208 last_incoming_stream_ = stream;
209 }
210
211 // Called when peer has data to read from incoming stream.
212 void OnDataReceived(net::QuicStreamId id, const char* data, size_t length) {
213 last_received_data_ = std::string(data, length);
214 }
215
216 std::string data() { return last_received_data_; }
217
218 bool has_data() { return data().size() > 0; }
219
220 FakeTransportChannel* channel() { return channel_.get(); }
221
222 ReliableQuicStream* incoming_stream() { return last_incoming_stream_; }
223
224 private:
225 // Transports QUIC packets to/from peer.
kwiberg3ec46792016-04-27 07:22:53 -0700226 std::unique_ptr<FakeTransportChannel> channel_;
mikescarlettcd0e4752016-02-08 17:35:47 -0800227 // Stores data received by peer once it is sent from the other peer.
228 std::string last_received_data_;
229 // Handles incoming streams from sender.
230 ReliableQuicStream* last_incoming_stream_ = nullptr;
231};
232
233// Simulates data transfer between two peers using QUIC.
234class QuicSessionTest : public ::testing::Test,
235 public QuicCryptoClientStream::ProofHandler {
236 public:
mikescarlett8d37d292016-04-29 15:35:00 -0700237 QuicSessionTest()
238 : quic_helper_(rtc::Thread::Current()),
239 quic_compressed_certs_cache_(
240 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {}
mikescarlettcd0e4752016-02-08 17:35:47 -0800241
242 // Instantiates |client_peer_| and |server_peer_|.
243 void CreateClientAndServerSessions();
244
kwiberg3ec46792016-04-27 07:22:53 -0700245 std::unique_ptr<QuicSessionForTest> CreateSession(
246 std::unique_ptr<FakeTransportChannel> channel,
mikescarlettcd0e4752016-02-08 17:35:47 -0800247 Perspective perspective);
248
249 QuicCryptoClientStream* CreateCryptoClientStream(QuicSessionForTest* session,
250 bool handshake_success);
251 QuicCryptoServerStream* CreateCryptoServerStream(QuicSessionForTest* session,
252 bool handshake_success);
253
kwiberg3ec46792016-04-27 07:22:53 -0700254 std::unique_ptr<QuicConnection> CreateConnection(
mikescarlettf5377682016-03-29 12:14:55 -0700255 FakeTransportChannel* channel,
256 Perspective perspective);
mikescarlettcd0e4752016-02-08 17:35:47 -0800257
258 void StartHandshake(bool client_handshake_success,
259 bool server_handshake_success);
260
261 // Test handshake establishment and sending/receiving of data.
262 void TestStreamConnection(QuicSessionForTest* from_session,
263 QuicSessionForTest* to_session);
264 // Test that client and server are not connected after handshake failure.
265 void TestDisconnectAfterFailedHandshake();
266
267 // QuicCryptoClientStream::ProofHelper overrides.
268 void OnProofValid(
269 const QuicCryptoClientConfig::CachedState& cached) override {}
270 void OnProofVerifyDetailsAvailable(
271 const ProofVerifyDetails& verify_details) override {}
272
273 protected:
274 QuicConnectionHelper quic_helper_;
275 QuicConfig config_;
276 QuicClock clock_;
mikescarlett8d37d292016-04-29 15:35:00 -0700277 QuicCompressedCertsCache quic_compressed_certs_cache_;
mikescarlettcd0e4752016-02-08 17:35:47 -0800278
kwiberg3ec46792016-04-27 07:22:53 -0700279 std::unique_ptr<QuicSessionForTest> client_peer_;
280 std::unique_ptr<QuicSessionForTest> server_peer_;
mikescarlettcd0e4752016-02-08 17:35:47 -0800281};
282
283// Initializes "client peer" who begins crypto handshake and "server peer" who
284// establishes encryption with client.
285void QuicSessionTest::CreateClientAndServerSessions() {
kwiberg3ec46792016-04-27 07:22:53 -0700286 std::unique_ptr<FakeTransportChannel> channel1(
mikescarlettb9dd7c52016-02-19 20:43:45 -0800287 new FakeTransportChannel("channel1", 0));
kwiberg3ec46792016-04-27 07:22:53 -0700288 std::unique_ptr<FakeTransportChannel> channel2(
mikescarlettb9dd7c52016-02-19 20:43:45 -0800289 new FakeTransportChannel("channel2", 0));
mikescarlettcd0e4752016-02-08 17:35:47 -0800290
291 // Prevent channel1->OnReadPacket and channel2->OnReadPacket from calling
292 // themselves in a loop, which causes to future packets to be recursively
293 // consumed while the current thread blocks consumption of current ones.
294 channel2->SetAsync(true);
295
296 // Configure peers to send packets to each other.
mikescarlettcd0e4752016-02-08 17:35:47 -0800297 channel1->SetDestination(channel2.get());
298
299 client_peer_ = CreateSession(std::move(channel1), Perspective::IS_CLIENT);
300 server_peer_ = CreateSession(std::move(channel2), Perspective::IS_SERVER);
301}
302
kwiberg3ec46792016-04-27 07:22:53 -0700303std::unique_ptr<QuicSessionForTest> QuicSessionTest::CreateSession(
304 std::unique_ptr<FakeTransportChannel> channel,
mikescarlettcd0e4752016-02-08 17:35:47 -0800305 Perspective perspective) {
kwiberg3ec46792016-04-27 07:22:53 -0700306 std::unique_ptr<QuicConnection> quic_connection =
mikescarlettcd0e4752016-02-08 17:35:47 -0800307 CreateConnection(channel.get(), perspective);
kwiberg3ec46792016-04-27 07:22:53 -0700308 return std::unique_ptr<QuicSessionForTest>(new QuicSessionForTest(
mikescarlettcd0e4752016-02-08 17:35:47 -0800309 std::move(quic_connection), config_, std::move(channel)));
310}
311
312QuicCryptoClientStream* QuicSessionTest::CreateCryptoClientStream(
313 QuicSessionForTest* session,
314 bool handshake_success) {
315 QuicCryptoClientConfig* client_config =
316 new QuicCryptoClientConfig(new FakeProofVerifier(handshake_success));
317 return new QuicCryptoClientStream(
318 kServerId, session, new ProofVerifyContext(), client_config, this);
319}
320
321QuicCryptoServerStream* QuicSessionTest::CreateCryptoServerStream(
322 QuicSessionForTest* session,
323 bool handshake_success) {
324 QuicCryptoServerConfig* server_config =
325 new QuicCryptoServerConfig("TESTING", QuicRandom::GetInstance(),
326 new FakeProofSource(handshake_success));
327 // Provide server with serialized config string to prove ownership.
328 QuicCryptoServerConfig::ConfigOptions options;
329 QuicServerConfigProtobuf* primary_config = server_config->GenerateConfig(
330 QuicRandom::GetInstance(), &clock_, options);
331 server_config->AddConfig(primary_config, clock_.WallNow());
mikescarlett8d37d292016-04-29 15:35:00 -0700332 bool use_stateless_rejects_if_peer_supported = false;
333 return new QuicCryptoServerStream(
334 server_config, &quic_compressed_certs_cache_,
335 use_stateless_rejects_if_peer_supported, session);
mikescarlettcd0e4752016-02-08 17:35:47 -0800336}
337
kwiberg3ec46792016-04-27 07:22:53 -0700338std::unique_ptr<QuicConnection> QuicSessionTest::CreateConnection(
mikescarlettcd0e4752016-02-08 17:35:47 -0800339 FakeTransportChannel* channel,
340 Perspective perspective) {
mikescarlettf5377682016-03-29 12:14:55 -0700341 FakeQuicPacketWriter* writer = new FakeQuicPacketWriter(channel);
mikescarlettcd0e4752016-02-08 17:35:47 -0800342
mikescarlettf5377682016-03-29 12:14:55 -0700343 IPAddress ip(0, 0, 0, 0);
mikescarlettcd0e4752016-02-08 17:35:47 -0800344 bool owns_writer = true;
345
kwiberg3ec46792016-04-27 07:22:53 -0700346 return std::unique_ptr<QuicConnection>(new QuicConnection(
mikescarlettf5377682016-03-29 12:14:55 -0700347 0, net::IPEndPoint(ip, 0), &quic_helper_, writer, owns_writer,
mikescarlettcd0e4752016-02-08 17:35:47 -0800348 perspective, net::QuicSupportedVersions()));
349}
350
351void QuicSessionTest::StartHandshake(bool client_handshake_success,
352 bool server_handshake_success) {
353 server_peer_->StartServerHandshake(
354 CreateCryptoServerStream(server_peer_.get(), server_handshake_success));
355 client_peer_->StartClientHandshake(
356 CreateCryptoClientStream(client_peer_.get(), client_handshake_success));
357}
358
359void QuicSessionTest::TestStreamConnection(QuicSessionForTest* from_session,
360 QuicSessionForTest* to_session) {
361 // Wait for crypto handshake to finish then check if encryption established.
362 ASSERT_TRUE_WAIT(from_session->IsCryptoHandshakeConfirmed() &&
363 to_session->IsCryptoHandshakeConfirmed(),
364 kTimeoutMs);
365
366 ASSERT_TRUE(from_session->IsEncryptionEstablished());
367 ASSERT_TRUE(to_session->IsEncryptionEstablished());
368
mikescarlett8d37d292016-04-29 15:35:00 -0700369 std::string from_key;
370 std::string to_key;
mikescarlettcd0e4752016-02-08 17:35:47 -0800371
372 bool from_success = from_session->ExportKeyingMaterial(
373 kExporterLabel, kExporterContext, kExporterContextLen, &from_key);
374 ASSERT_TRUE(from_success);
375 bool to_success = to_session->ExportKeyingMaterial(
376 kExporterLabel, kExporterContext, kExporterContextLen, &to_key);
377 ASSERT_TRUE(to_success);
378
379 EXPECT_EQ(from_key.size(), kExporterContextLen);
380 EXPECT_EQ(from_key, to_key);
381
382 // Now we can establish encrypted outgoing stream.
383 ReliableQuicStream* outgoing_stream =
384 from_session->CreateOutgoingDynamicStream(kDefaultPriority);
385 ASSERT_NE(nullptr, outgoing_stream);
386 EXPECT_TRUE(from_session->HasOpenDynamicStreams());
387
388 outgoing_stream->SignalDataReceived.connect(
389 from_session, &QuicSessionForTest::OnDataReceived);
390 to_session->SignalIncomingStream.connect(
391 to_session, &QuicSessionForTest::OnIncomingStream);
392
393 // Send a test message from peer 1 to peer 2.
394 const char kTestMessage[] = "Hello, World!";
395 outgoing_stream->Write(kTestMessage, strlen(kTestMessage));
396
397 // Wait for peer 2 to receive messages.
398 ASSERT_TRUE_WAIT(to_session->has_data(), kTimeoutMs);
399
400 ReliableQuicStream* incoming = to_session->incoming_stream();
401 ASSERT_TRUE(incoming);
402 EXPECT_TRUE(to_session->HasOpenDynamicStreams());
403
404 EXPECT_EQ(to_session->data(), kTestMessage);
405
406 // Send a test message from peer 2 to peer 1.
407 const char kTestResponse[] = "Response";
408 incoming->Write(kTestResponse, strlen(kTestResponse));
409
410 // Wait for peer 1 to receive messages.
411 ASSERT_TRUE_WAIT(from_session->has_data(), kTimeoutMs);
412
413 EXPECT_EQ(from_session->data(), kTestResponse);
414}
415
416// Client and server should disconnect when proof verification fails.
417void QuicSessionTest::TestDisconnectAfterFailedHandshake() {
418 EXPECT_TRUE_WAIT(!client_peer_->connection()->connected(), kTimeoutMs);
419 EXPECT_TRUE_WAIT(!server_peer_->connection()->connected(), kTimeoutMs);
420
421 EXPECT_FALSE(client_peer_->IsEncryptionEstablished());
422 EXPECT_FALSE(client_peer_->IsCryptoHandshakeConfirmed());
423
424 EXPECT_FALSE(server_peer_->IsEncryptionEstablished());
425 EXPECT_FALSE(server_peer_->IsCryptoHandshakeConfirmed());
426}
427
428// Establish encryption then send message from client to server.
429TEST_F(QuicSessionTest, ClientToServer) {
430 CreateClientAndServerSessions();
431 StartHandshake(true, true);
432 TestStreamConnection(client_peer_.get(), server_peer_.get());
433}
434
435// Establish encryption then send message from server to client.
436TEST_F(QuicSessionTest, ServerToClient) {
437 CreateClientAndServerSessions();
438 StartHandshake(true, true);
439 TestStreamConnection(server_peer_.get(), client_peer_.get());
440}
441
442// Make client fail to verify proof from server.
443TEST_F(QuicSessionTest, ClientRejection) {
444 CreateClientAndServerSessions();
445 StartHandshake(false, true);
446 TestDisconnectAfterFailedHandshake();
447}
448
449// Make server fail to give proof to client.
450TEST_F(QuicSessionTest, ServerRejection) {
451 CreateClientAndServerSessions();
452 StartHandshake(true, false);
453 TestDisconnectAfterFailedHandshake();
454}
455
456// Test that data streams are not created before handshake.
457TEST_F(QuicSessionTest, CannotCreateDataStreamBeforeHandshake) {
458 CreateClientAndServerSessions();
459 EXPECT_EQ(nullptr, server_peer_->CreateOutgoingDynamicStream(5));
460 EXPECT_EQ(nullptr, client_peer_->CreateOutgoingDynamicStream(5));
461}
mikescarlett18b67a52016-04-11 16:56:23 -0700462
463// Test that closing a QUIC stream causes the QuicSession to remove it.
464TEST_F(QuicSessionTest, CloseQuicStream) {
465 CreateClientAndServerSessions();
466 StartHandshake(true, true);
467 ASSERT_TRUE_WAIT(client_peer_->IsCryptoHandshakeConfirmed() &&
468 server_peer_->IsCryptoHandshakeConfirmed(),
469 kTimeoutMs);
470 ReliableQuicStream* stream = client_peer_->CreateOutgoingDynamicStream(5);
471 ASSERT_NE(nullptr, stream);
472 EXPECT_FALSE(client_peer_->IsClosedStream(stream->id()));
473 stream->Close();
474 EXPECT_TRUE(client_peer_->IsClosedStream(stream->id()));
475}