use of io.servicetalk.transport.api.ServerContext in project servicetalk by apple.
the class GrpcSslAndNonSslConnectionsTest method secureClientToNonSecureServerClosesConnection.
@Test
void secureClientToNonSecureServerClosesConnection() throws Exception {
try (ServerContext serverContext = nonSecureGrpcServer();
BlockingTesterClient client = secureGrpcClient(serverContext, new ClientSslConfigBuilder(DefaultTestCerts::loadServerCAPem).peerHost(serverPemHostname())).buildBlocking(clientFactory())) {
GrpcStatusException e = assertThrows(GrpcStatusException.class, () -> client.test(REQUEST));
assertThat(e.getCause(), instanceOf(SSLHandshakeException.class));
}
}
use of io.servicetalk.transport.api.ServerContext in project baremaps by baremaps.
the class Edit method call.
@Override
public Integer call() throws Exception {
BlobStore blobStore = options.blobStore();
DataSource dataSource = PostgresUtils.datasource(database);
// Configure serialization
ObjectMapper objectMapper = defaultObjectMapper();
// Configure the application
ResourceConfig application = new ResourceConfig().register(CorsFilter.class).register(EditorResources.class).register(contextResolverFor(objectMapper)).register(new AbstractBinder() {
@Override
protected void configure() {
bind(tileset).to(URI.class).named("tileset");
bind(style).to(URI.class).named("style");
bind(blobStore).to(BlobStore.class);
bind(dataSource).to(DataSource.class);
bind(objectMapper).to(ObjectMapper.class);
}
});
BlockingStreamingHttpService httpService = new HttpJerseyRouterBuilder().buildBlockingStreaming(application);
ServerContext serverContext = HttpServers.forPort(port).listenBlockingStreamingAndAwait(httpService);
logger.info("Listening on {}", serverContext.listenAddress());
serverContext.awaitShutdown();
return 0;
}
Aggregations