newStream method
NewStream constructs a new Stream over this conn.
Implementation
@override
Future<P2PStream> newStream(Context context) async {
// This is the client-side opening of a stream.
// It maps to MuxedConn.openStream
final core_mux.MuxedStream muxedStream = await _muxedConn.openStream(context);
if (muxedStream is P2PStream) {
return muxedStream as P2PStream;
} else {
// This path should ideally not be hit if YamuxStream correctly implements P2PStream
throw Exception('MuxedStream from _muxedConn.openStream() is not a P2PStream. Type: ${muxedStream.runtimeType}');
}
}