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
@Test | |
void revoked() throws IOException { | |
get("https://revoked.sca1a.amazontrust.com/", urlConnection -> { | |
assertThatExceptionOfType(SSLHandshakeException.class) | |
.isThrownBy(urlConnection::getResponseCode) | |
.withRootCauseInstanceOf(CertificateRevokedException.class); | |
}); | |
} |
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
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 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 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 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 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 IteratorDataSourceImpl implements IteratorDataSource { | |
private PagedDataSource pagedDataSource; | |
@Override | |
public Iterator<Entity> getAllEntities() { | |
return new PagedIterator(Paging.firstPage(), (Paging paging) -> pagedDataSource.getEntities(paging).iterator()); | |
} | |
private static class PagedIterator implements Iterator<Entity> { |
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
public interface IteratorDataSource { | |
Iterator<Entity> getAllEntities(); | |
} |
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
import com.mxgraph.canvas.mxICanvas; | |
import com.mxgraph.canvas.mxSvgCanvas; | |
import com.mxgraph.io.mxCodec; | |
import com.mxgraph.util.mxCellRenderer; | |
import com.mxgraph.util.mxDomUtils; | |
import com.mxgraph.util.mxUtils; | |
import com.mxgraph.util.mxXmlUtils; | |
import com.mxgraph.view.mxGraph; | |
public class DrawIoConverter{ |
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
public class PagedDataSourceConsumer { | |
private PagedDataSource pagedDataSource; | |
public void consume() { | |
List<Entity> entities; | |
Paging nextPage = Paging.firstPage(); | |
for(entities = pagedDataSource.getEntities(nextPage); !entities.isEmpty(); entities = pagedDataSource.getEntities(nextPage)) { | |
for(Entity entity: entities) { | |
//doStuff | |
} | |
nextPage = nextPage.next(); |
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
public interface PagedDataSource { | |
List<Entity> getEntities(Paging paging); | |
} |
NewerOlder