testClient static method
Get an SSE client for use in unit tests.
Most parameters are the same as those of the main SSEClient factory, but
the test client supports an additional property which is the sourceStream
.
Events sent to the sourceStream
will also be emitted by the event source
if the event source has listeners. When a user unsubscribes from the event
stream, then the test client will unsubscribe from the source stream.
This method is primarily for use the the LaunchDarkly SDK implementation. Changes may be made to this API without following semantic conventions.
Implementation
static TestSseClient testClient(
Uri uri,
Set<String> eventTypes, {
Map<String, String> headers = defaultHeaders,
Duration connectTimeout = defaultConnectTimeout,
Duration readTimeout = defaultReadTimeout,
String? body,
SseHttpMethod httpMethod = SseHttpMethod.get,
Stream<Event>? sourceStream,
}) {
return TestSseClient.internal(
headers: UnmodifiableMapView(headers),
connectTimeout: connectTimeout,
readTimeout: readTimeout,
body: body,
httpMethod: httpMethod,
sourceStream: sourceStream);
}