-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
229 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
http-client/src/test/groovy/io/micronaut/http/client/netty/CancellableMonoSinkSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.micronaut.http.client.netty | ||
|
||
import org.reactivestreams.Subscriber | ||
import org.reactivestreams.Subscription | ||
import reactor.core.publisher.Mono | ||
import spock.lang.Specification | ||
|
||
class CancellableMonoSinkSpec extends Specification { | ||
def "cancel before request"() { | ||
given: | ||
def sink = new CancellableMonoSink<String>(null) | ||
def result = "unset" | ||
Subscription subscription = null | ||
sink.subscribe(new Subscriber<String>() { | ||
@Override | ||
void onSubscribe(Subscription s) { | ||
subscription = s | ||
} | ||
|
||
@Override | ||
void onNext(String s) { | ||
result = s | ||
} | ||
|
||
@Override | ||
void onError(Throwable t) { | ||
} | ||
|
||
@Override | ||
void onComplete() { | ||
} | ||
}) | ||
|
||
when: | ||
sink.cancel() | ||
subscription.request(1) | ||
|
||
then: | ||
result == "unset" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters