public ServiceRequestContext build() {
        // Determine the client address; use remote address unless overridden.
        final ProxiedAddresses proxiedAddresses;
        if (this.proxiedAddresses != null) {
            proxiedAddresses = this.proxiedAddresses;
        } else {
            proxiedAddresses = ProxiedAddresses.of(remoteAddress());
        }

        // Build a fake server which never starts up.
        final ServerBuilder serverBuilder = Server.builder()
                                                  .meterRegistry(meterRegistry());

        final ServiceBindingBuilder serviceBindingBuilder;
        if (route != null) {
            serviceBindingBuilder = serverBuilder.route().addRoute(route);
        } else {
            serviceBindingBuilder = serverBuilder.route().path(requestTarget().path());
        }

        if (defaultServiceNaming != null) {
            serviceBindingBuilder.defaultServiceNaming(defaultServiceNaming);
        }
        if (defaultLogName != null) {
            serviceBindingBuilder.defaultLogName(defaultLogName);
        }
        serviceBindingBuilder.build(service);

        serverConfigurators.forEach(configurator -> configurator.accept(serverBuilder));

        final Server server = serverBuilder.build();
        server.addListener(rejectingListener);

        // Retrieve the ServiceConfig of the fake service.
        final ServiceConfig serviceCfg = findServiceConfig(server, service);

        // Build the fake objects related with path mapping.
        final HttpRequest req = request();
        assert req != null;

        final RoutingContext routingCtx = DefaultRoutingContext.of(
                server.config().defaultVirtualHost(),
                localAddress().getHostString(),
                requestTarget(),
                req.headers(),
                RoutingStatus.OK, sessionProtocol());

        final RoutingResult routingResult =
                this.routingResult != null ? this.routingResult
                                           : RoutingResult.builder()
                                                          .path(requestTarget().path())
                                                          .query(requestTarget().query())
                                                          .build();
        final Route route = Route.builder().path(requestTarget().path()).build();
        final Routed<ServiceConfig> routed = Routed.of(route, routingResult, serviceCfg);
        routingCtx.setResult(routed);
        final ExchangeType exchangeType = service.exchangeType(routingCtx);
        final InetAddress clientAddress = server.config().clientAddressMapper().apply(proxiedAddresses)
                                                .getAddress();

        EventLoop eventLoop = eventLoop();
        if (eventLoop == null) {
            eventLoop = CommonPools.workerGroup().next();
        }

        final CancellationScheduler requestCancellationScheduler;
        if (timedOut()) {
            requestCancellationScheduler = CancellationScheduler.finished(true);
        } else {
            requestCancellationScheduler = CancellationScheduler.ofServer(0);
            requestCancellationScheduler.initAndStart(eventLoop, noopCancellationTask);
        }

        // Build the context with the properties set by a user and the fake objects.
        final Channel ch = fakeChannel(eventLoop);
        return new DefaultServiceRequestContext(
                serviceCfg, ch, eventLoop, meterRegistry(), sessionProtocol(), id(), routingCtx,
                routingResult, exchangeType, req, sslSession(), proxiedAddresses,
                clientAddress, remoteAddress(), localAddress(),
                requestCancellationScheduler,
                isRequestStartTimeSet() ? requestStartTimeNanos() : System.nanoTime(),
                isRequestStartTimeSet() ? requestStartTimeMicros() : SystemInfo.currentTimeMicros(),
                HttpHeaders.of(), HttpHeaders.of(), serviceCfg.contextHook());
    }
Returns a new {@link ServiceRequestContext} created with the properties of this builder.
core/src/main/java/com/linecorp/armeria/server/ServiceRequestContextBuilder.java