1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1042, cover RTMP client protocol.

This commit is contained in:
winlin 2019-12-11 15:59:29 +08:00
parent 69817a9f34
commit 41a9f15626
4 changed files with 190 additions and 0 deletions

View file

@ -113,6 +113,12 @@ MockBufferIO* MockBufferIO::append(string data)
return this;
}
MockBufferIO* MockBufferIO::append(MockBufferIO* data)
{
in_buffer.append(&data->in_buffer);
return this;
}
MockBufferIO* MockBufferIO::append(uint8_t* data, int size)
{
in_buffer.append((char*)data, size);
@ -130,6 +136,12 @@ MockBufferIO* MockBufferIO::out_append(string data)
return this;
}
MockBufferIO* MockBufferIO::out_append(MockBufferIO* data)
{
out_buffer.append(&data->out_buffer);
return this;
}
MockBufferIO* MockBufferIO::out_append(uint8_t* data, int size)
{
out_buffer.append((char*)data, size);
@ -488,6 +500,15 @@ VOID TEST(ProtocolHandshakeTest, ComplexHandshake)
SrsRtmpClient r(&io);
HELPER_EXPECT_SUCCESS(r.complex_handshake());
}
if (true) {
MockBufferIO io;
io.append(c0c1, 1537);
io.append(c2, 1536);
SrsRtmpServer r(&io);
HELPER_EXPECT_SUCCESS(r.handshake());
}
}
VOID TEST(ProtocolHandshakeTest, SimpleHandshake)
@ -539,6 +560,15 @@ VOID TEST(ProtocolHandshakeTest, SimpleHandshake)
SrsRtmpClient r(&io);
HELPER_EXPECT_SUCCESS(r.simple_handshake());
}
if (true) {
MockBufferIO io;
io.append(c0c1, 1537);
io.append(c2, 1536);
SrsRtmpServer r(&io);
HELPER_EXPECT_SUCCESS(r.handshake());
}
}
/**