Remove EmbeddedChannel restriction to IOData (#763)

Remove EmbeddedChannel restriction to IOData

Motivation:

You should be able to read any type from the outbound buffer.

Modifications:

Change Embedded channel outboundBuffer and pendingOutboundBuffer to store NIOAny instead of IOData and refactor test code accordingly.

Result:

- Users can test what went through the pipeline without serializing everything and using "if case let" syntax everywhere.
- fixes #551
This commit is contained in:
JovanMilenkovic authored and Johannes Weiss committed 2019-01-30 19:24:59 +00:00
1 parent 70c714a54d
commit cf56bfd119
15 files changed
+89 -123

No files matched your search

@@ -133,7 +133,7 @@ class HTTPDecoderLengthTest: XCTestCase {
// Prime the decoder with a GET and consume it.
XCTAssertTrue(try channel.writeOutbound(HTTPClientRequestPart.head(HTTPRequestHead(version: version, method: .GET, uri: "/"))))
XCTAssertNotNil(channel.readOutbound())
XCTAssertNotNil(channel.readOutbound(as: ByteBuffer.self))
// We now want to send a HTTP/1.1 response. This response has no content-length, no transfer-encoding,
// is not a response to a HEAD request, is not a 2XX response to CONNECT, and is not 1XX, 204, or 304.
@@ -198,7 +198,7 @@ class HTTPDecoderLengthTest: XCTestCase {
XCTAssertTrue(try channel.writeOutbound(HTTPClientRequestPart.head(HTTPRequestHead(version: .init(major: 1, minor: 1),
method: requestMethod,
uri: "/"))))
XCTAssertNotNil(channel.readOutbound())
XCTAssertNotNil(channel.readOutbound(as: ByteBuffer.self))
// We now want to send a HTTP/1.1 response. This response may contain some length framing fields that RFC 7230 says MUST
// be ignored.
@@ -337,7 +337,7 @@ class HTTPDecoderLengthTest: XCTestCase {
XCTAssertTrue(try channel.writeOutbound(HTTPClientRequestPart.head(HTTPRequestHead(version: .init(major: 1, minor: 1),
method: .GET,
uri: "/"))))
XCTAssertNotNil(channel.readOutbound())
XCTAssertNotNil(channel.readOutbound(as: ByteBuffer.self))
// Send a 200 with the appropriate Transfer Encoding header. We should see the request,
// but no body or end.