/** * Sets the request start time of the request. * * @param requestStartTimeNanos the {@link System#nanoTime()} value when the request started. * @param requestStartTimeMicros the number of microseconds since the epoch when the request started. */ public final B requestStartTime(long requestStartTimeNanos, long requestStartTimeMicros) { this.requestStartTimeNanos = requestStartTimeNanos; this.requestStartTimeMicros = requestStartTimeMicros; requestStartTimeSet = true; return self(); }
/** * Sets the local socket address of the connection. If not set, it is auto-generated with the localhost * IP address (e.g. {@code "127.0.0.1"} or {@code "::1"}). */ public final B localAddress(InetSocketAddress localAddress) { this.localAddress = requireNonNull(localAddress, "localAddress"); return self(); }
/** * Sets the {@link MeterRegistry}. If not set, {@link NoopMeterRegistry} is used. */ public final B meterRegistry(MeterRegistry meterRegistry) { this.meterRegistry = requireNonNull(meterRegistry, "meterRegistry"); return self(); }
/** * Sets the {@link EventLoop} that handles the request. * If not set, one of the {@link CommonPools#workerGroup()} is used. */ public final B eventLoop(EventLoop eventLoop) { this.eventLoop = requireNonNull(eventLoop, "eventLoop"); return self(); }
/** * Sets the remote socket address of the connection. If not set, it is auto-generated with the localhost * IP address (e.g. {@code "127.0.0.1"} or {@code "::1"}). */ public final B remoteAddress(InetSocketAddress remoteAddress) { this.remoteAddress = requireNonNull(remoteAddress, "remoteAddress"); return self(); }
/** * Sets the {@link ByteBufAllocator}. If not set, {@link ByteBufAllocator#DEFAULT} is used. */ public final B alloc(ByteBufAllocator alloc) { this.alloc = requireNonNull(alloc, "alloc"); return self(); }
/** * Sets the {@link SessionProtocol} of the request. * * @throws IllegalArgumentException if the specified {@link SessionProtocol} is not compatible with * the scheme of the {@link URI} you specified when creating this builder. * For example, you cannot specify {@link SessionProtocol#H2C} if you * created this builder with {@code h1c://example.com/}. */ public final B sessionProtocol(SessionProtocol sessionProtocol) { requireNonNull(sessionProtocol, "sessionProtocol"); if (request instanceof RpcRequest) { checkArgument(sessionProtocol == this.sessionProtocol, "sessionProtocol: %s (expected: same as the session protocol specified in 'uri')", sessionProtocol); } else { this.sessionProtocol = sessionProtocol; } return self(); }
/** * Sets the {@link HttpMethod} of the request. * * @throws IllegalArgumentException if the specified {@link HttpMethod} is not same with the * {@link HttpMethod} of the {@link HttpRequest} you specified when * creating this builder. This exception is not thrown if you * created a builder with an {@link RpcRequest}. */ protected B method(HttpMethod method) { requireNonNull(method, "method"); if (request instanceof HttpRequest) { checkArgument(method == ((HttpRequest) request).method(), "method: %s (expected: same as request.method)", method); } else { this.method = method; } return self(); }
/** * Sets the {@link SSLSession} of the connection. If the current {@link SessionProtocol} is not TLS, * the TLS version of the current {@link SessionProtocol} will be set automatically. For example, * {@link SessionProtocol#H2C} will be automatically upgraded to {@link SessionProtocol#H2}. * Note that upgrading the current {@link SessionProtocol} may trigger an {@link IllegalArgumentException}, * as described in {@link #sessionProtocol(SessionProtocol)}. */ public final B sslSession(SSLSession sslSession) { this.sslSession = requireNonNull(sslSession, "sslSession"); switch (sessionProtocol) { case HTTP: sessionProtocol(SessionProtocol.HTTPS); break; case H1C: sessionProtocol(SessionProtocol.H1); break; case H2C: sessionProtocol(SessionProtocol.H2); break; } return self(); }