Java Code Examples for com.linecorp.armeria.server.ServerBuilder#https()
The following examples show how to use
com.linecorp.armeria.server.ServerBuilder#https() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArmeriaGrpcServerInteropTest.java From armeria with Apache License 2.0 | 6 votes |
@Override protected void configure(ServerBuilder sb) throws Exception { sb.https(new InetSocketAddress("127.0.0.1", 0)); sb.tls(ssc.certificateFile(), ssc.privateKeyFile()); sb.tlsCustomizer(ssl -> { try { ssl.trustManager(TestUtils.loadCert("ca.pem")); } catch (IOException e) { Exceptions.throwUnsafely(e); } }); sb.maxRequestLength(16 * 1024 * 1024); sb.serviceUnder("/", grpcService.decorate((delegate, ctx, req) -> { ctxCapture.set(ctx); return delegate.serve(ctx, req); })); }
Example 2
Source File: MockWebServerExtension.java From armeria with Apache License 2.0 | 5 votes |
@Override protected final void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.serviceUnder("/", new MockWebService()); configureServer(sb); }
Example 3
Source File: ManagedTomcatServiceTest.java From armeria with Apache License 2.0 | 5 votes |
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.serviceUnder( "/jsp/", TomcatService.builder(webAppRoot()) .serviceName(SERVICE_NAME) .configurator(s -> Collections.addAll(tomcatServices, s.findServices())) .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/jar/", TomcatService.builder(AppRootFinder.find(Future.class)) .serviceName("TomcatServiceTest-JAR") .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/jar_altroot/", TomcatService.builder(AppRootFinder.find(Future.class), "/io/netty/util/concurrent") .serviceName("TomcatServiceTest-JAR-AltRoot") .build() .decorate(LoggingService.newDecorator())); }
Example 4
Source File: JettyServiceTest.java From armeria with Apache License 2.0 | 5 votes |
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.serviceUnder( "/jsp/", JettyService.builder() .handler(newWebAppContext()) .configurator(s -> jettyBeans.addAll(s.getBeans())) .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/default/", JettyService.builder() .handler(new DefaultHandler()) .build()); final ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase(webAppRoot().getPath()); sb.serviceUnder( "/resources/", JettyService.builder() .handler(resourceHandler) .build()); }
Example 5
Source File: JettyServiceStartupTest.java From armeria with Apache License 2.0 | 5 votes |
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.serviceUnder( "/jsp/", JettyService.builder() .handler(newWebAppContext()) .configurator(s -> jettyBeans.addAll(s.getBeans())) .build() .decorate(LoggingService.newDecorator())); sb.serviceUnder( "/default/", JettyService.builder() .handler(new DefaultHandler()) .build()); final ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase(WebAppContainerTest.webAppRoot().getPath()); sb.serviceUnder( "/resources/", JettyService.builder() .handler(resourceHandler) .build()); }
Example 6
Source File: UnmanagedJettyServiceTest.java From armeria with Apache License 2.0 | 5 votes |
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); jetty = new Server(0); jetty.setHandler(JettyServiceTest.newWebAppContext()); jetty.start(); sb.serviceUnder( "/jsp/", JettyService.of(jetty).decorate(LoggingService.newDecorator())); }
Example 7
Source File: HealthCheckedEndpointGroupIntegrationTest.java From armeria with Apache License 2.0 | 5 votes |
@Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.service(HEALTH_CHECK_PATH, HealthCheckService.builder().longPolling(0).build()); }
Example 8
Source File: GrpcClientTest.java From armeria with Apache License 2.0 | 4 votes |
@Override protected void configure(ServerBuilder sb) { sb.workerGroup(EventLoopGroups.newEventLoopGroup(1), true); sb.maxRequestLength(MAX_MESSAGE_SIZE); sb.idleTimeoutMillis(0); sb.http(0); sb.https(0); sb.tlsSelfSigned(); final ServerServiceDefinition interceptService = ServerInterceptors.intercept( new TestServiceImpl(Executors.newSingleThreadScheduledExecutor()), new ServerInterceptor() { @Override public <REQ, RESP> Listener<REQ> interceptCall( ServerCall<REQ, RESP> call, Metadata requestHeaders, ServerCallHandler<REQ, RESP> next) { final HttpHeadersBuilder fromClient = HttpHeaders.builder(); MetadataUtil.fillHeaders(requestHeaders, fromClient); CLIENT_HEADERS_CAPTURE.set(fromClient.build()); return next.startCall( new SimpleForwardingServerCall<REQ, RESP>(call) { @Override public void close(Status status, Metadata trailers) { trailers.merge(requestHeaders); super.close(status, trailers); } }, requestHeaders); } }); sb.serviceUnder("/", GrpcService.builder() .addService(interceptService) .setMaxInboundMessageSizeBytes(MAX_MESSAGE_SIZE) .setMaxOutboundMessageSizeBytes(MAX_MESSAGE_SIZE) .useClientTimeoutHeader(false) .build() .decorate((client, ctx, req) -> { final HttpResponse res = client.serve(ctx, req); return new FilteredHttpResponse(res) { private boolean headersReceived; @Override protected HttpObject filter(HttpObject obj) { if (obj instanceof HttpHeaders) { if (!headersReceived) { headersReceived = true; } else { SERVER_TRAILERS_CAPTURE.set((HttpHeaders) obj); } } return obj; } }; })); }