Configure the
{@link ClientCookieEncoder}, {@link ClientCookieDecoder} will be
chosen based on the encoder

@param encoder the preferred ClientCookieEncoder

@return a new {@link HttpClient}
769893
public final HttpClient cookieCodec(ClientCookieEncoder encoder) {
		ClientCookieDecoder decoder = encoder == ClientCookieEncoder.LAX ?
				ClientCookieDecoder.LAX : ClientCookieDecoder.STRICT;
		return cookieCodec(encoder, decoder);
	}
1045979
static ClientRequestResponseChannel clientChannel(
          final Configuration configuration,
          final ResponseChannelConsumer consumer,
          final Logger logger) throws Exception {
    return new ClientRequestResponseChannel(
            configuration.addressOfHost,
            consumer,
            configuration.readBufferPoolSize,
            configuration.readBufferSize,
            logger);
  }
156219
public final HttpServer cookieCodec(ServerCookieEncoder encoder, ServerCookieDecoder decoder) {
		return tcpConfiguration(tcp -> tcp.bootstrap(
				b -> HttpServerConfiguration.cookieCodec(b, encoder, decoder)));
	}
1307584
public <T extends Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder>> T newClient(Class<? extends Client> clientClass) {
        Client client;
        try {
            client = clientClass.newInstance();
            return (T) client;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
705060
public final HttpClient doOnResponse(BiConsumer<? super HttpClientResponse, ? super Connection> doOnResponse) {
		Objects.requireNonNull(doOnResponse, "doOnResponse");
		return new HttpClientDoOn(this, null, null, doOnResponse, null);
	}
6248
public static BasicClientCookie convertToHttpClientCookie(final Cookie seleniumCookie) {
        BasicClientCookie httpClientCookie
                = new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue());
        httpClientCookie.setDomain(seleniumCookie.getDomain());
        httpClientCookie.setPath(seleniumCookie.getPath());
        httpClientCookie.setExpiryDate(seleniumCookie.getExpiry());
        httpClientCookie.setSecure(seleniumCookie.isSecure());

        if (seleniumCookie.isHttpOnly()) {
            httpClientCookie.setAttribute(HTTP_ONLY_ATTRIBUTE, StringUtils.EMPTY);
        }

        return httpClientCookie;
    }
1323725
private void configureProxyServer(ChannelPipeline clientPipeline) {
        if (proxyServerConfiguration != null && sslConfig != null) {
            if (proxyServerConfiguration.getProxyUsername() != null
                    && proxyServerConfiguration.getProxyPassword() != null) {
                clientPipeline.addLast(Constants.PROXY_HANDLER,
                        new HttpProxyHandler(proxyServerConfiguration.getInetSocketAddress(),
                                proxyServerConfiguration.getProxyUsername(),
                                proxyServerConfiguration.getProxyPassword()));
            } else {
                clientPipeline.addLast(Constants.PROXY_HANDLER,
                        new HttpProxyHandler(proxyServerConfiguration.getInetSocketAddress()));
            }
        }
    }
819950
public static HttpHandler configureCompression(Compression compression,
			HttpHandler httpHandler) {
		if (compression == null || !compression.getEnabled()) {
			return httpHandler;
		}
		ContentEncodingRepository repository = new ContentEncodingRepository();
		repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50,
				Predicates.and(getCompressionPredicates(compression)));
		return new EncodingHandler(repository).setNext(httpHandler);
	}
606453
public static Function<Service<HttpRequest, HttpResponse>,
            HttpEncodingService> contentEncodingDecorator(@Nullable String[] mimeTypes,
                                                          @Nullable String[] excludedUserAgents,
                                                          long minBytesToForceChunkedAndEncoding) {
        final Predicate<MediaType> encodableContentTypePredicate;
        if (mimeTypes == null || mimeTypes.length == 0) {
            encodableContentTypePredicate = contentType -> true;
        } else {
            final List<MediaType> encodableContentTypes =
                    Arrays.stream(mimeTypes).map(MediaType::parse).collect(toImmutableList());
            encodableContentTypePredicate = contentType ->
                    encodableContentTypes.stream().anyMatch(contentType::is);
        }

        final Predicate<HttpHeaders> encodableRequestHeadersPredicate;
        if (excludedUserAgents == null || excludedUserAgents.length == 0) {
            encodableRequestHeadersPredicate = headers -> true;
        } else {
            final List<Pattern> patterns =
                    Arrays.stream(excludedUserAgents).map(Pattern::compile).collect(toImmutableList());
            encodableRequestHeadersPredicate = headers -> {
                // No User-Agent header will be converted to an empty string.
                final String userAgent = headers.get(HttpHeaderNames.USER_AGENT, "");
                return patterns.stream().noneMatch(pattern -> pattern.matcher(userAgent).matches());
            };
        }

        return delegate -> new HttpEncodingService(delegate,
                                                   encodableContentTypePredicate,
                                                   encodableRequestHeadersPredicate,
                                                   minBytesToForceChunkedAndEncoding);
    }
707259
public T encoder(Encoder e) {
        if (!encoders.contains(e)) {
            encoders.add(e);
        }
        return derived.cast(this);
    }
369004
public <T> HttpClientRequest.Builder<T> options(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.OPTIONS, uri, httpHandler);
    }
602518
public final HttpClient httpResponseDecoder(Function<HttpResponseDecoderSpec, HttpResponseDecoderSpec> responseDecoderOptions) {
		return tcpConfiguration(
				responseDecoderOptions.apply(new HttpResponseDecoderSpec())
				                      .build());
	}
954859
public static HttpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
                                                         Observable<Host> hostStream) {
        return HttpClientImpl.create(providerFactory, hostStream);
    }
408506
public static SslHandler createSslHandler(final boolean clientMode) {
        final SSLEngine engine = createEngine(clientMode);
        final SslHandler handler = new SslHandler(engine);
        handler.handshakeFuture().addListener(new GenericFutureListener<Future<? super Channel>>() {
            @Override
            public void operationComplete(final Future<? super Channel> future) throws Exception {
                LOG.debug("Using cipher " + engine.getSession().getCipherSuite()
                        + " for the encrypted connection to the server.");
            }
        });
        return handler;
    }
1039922
public static void setCookie(String name, String value, int maxAge, boolean httpOnly, HttpServletRequest request, HttpServletResponse response) {
		String domain = request.getServerName();
		// String domain = serverName;
		setCookie(name, value, maxAge, httpOnly, domain, response);
	}
1150714
public <TCoder extends BinaryEncoder & BinaryDecoder> CodecCipher setCoder(TCoder coder)
    {
        this.encoder = coder;
        this.decoder = coder;

        return this;
    }
593009
public CloseableHttpClient NewHttpClient() throws Exception {
    	SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
    	SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext);
    	this.httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
    	return this.httpclient;
    }