This file contains hidden or 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
public class IteratorDataSourceConsumer { | |
private IteratorDataSource iteratorDataSource; | |
public void consume() { | |
iteratorDataSource.getAllEntities().forEachRemaining(entity -> { | |
//doStuff | |
}); | |
} | |
} |
This file contains hidden or 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
import io.netty.bootstrap.Bootstrap | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.SimpleChannelInboundHandler | |
import io.netty.channel.nio.NioEventLoopGroup | |
import io.netty.channel.socket.nio.NioDatagramChannel | |
import io.netty.util.CharsetUtil | |
import io.netty.util.concurrent.DefaultThreadFactory | |
import kotlinx.coroutines.experimental.async | |
import kotlinx.coroutines.experimental.newFixedThreadPoolContext |
This file contains hidden or 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
class ApiCaller { | |
private WebClient webClient; | |
ApiCaller(WebClient webClient) { | |
this.webClient = webClient; | |
} | |
Mono<SimpleResponseDto> callApi() { | |
return webClient.put() |
This file contains hidden or 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
class ApiCallerTest { | |
private final MockWebServer mockWebServer = new MockWebServer(); | |
private final ApiCaller apiCaller = new ApiCaller(WebClient.create(mockWebServer.url("/").toString())); | |
@AfterEach | |
void tearDown() throws IOException { | |
mockWebServer.shutdown(); | |
} |
This file contains hidden or 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
@Test | |
void revoked() throws IOException { | |
get("https://revoked.sca1a.amazontrust.com/", urlConnection -> { | |
assertThatExceptionOfType(SSLHandshakeException.class) | |
.isThrownBy(urlConnection::getResponseCode) | |
.withRootCauseInstanceOf(CertificateRevokedException.class); | |
}); | |
} |
OlderNewer