qbit/core/src/main/java/io/advantageous/qbit/proxy/ProxyServiceImpl.java
private void createBackEndRequestPopulateAndForward(final HttpRequest clientRequest) {
        try {

            if (backendServiceHttpClient == null) {
                handleHttpClientErrorsForBackend(clientRequest, new HttpClientClosedConnectionException("Not connected"));
                long timeSinceLastStart = time - lastHttpClientStart;
                if (timeSinceLastStart > 10_000) {
                    checkClient();
                }
                return;
            }
    /* forward request to backend client. */
            final HttpRequestBuilder httpRequestBuilder = HttpRequestBuilder.httpRequestBuilder()
                    .copyRequest(clientRequest).setBinaryReceiver(new HttpBinaryReceiver() {
                        @Override
                        public void response(final int code,
                                             final String contentType,
                                             final byte[] body,
                                             final MultiMap<String, String> headers) {
                            handleBackendClientResponses(clientRequest, code, contentType, body, headers);
                        }

                        @Override
                        public void response(int code, String contentType, byte[] body) {
                            response(code, contentType, body, MultiMap.empty());
                        }
                    }).setErrorHandler(e -> handleHttpClientErrorsForBackend(clientRequest, e));

            /** Give user of the lib a chance to populate headers and such. */
            beforeSend.accept(httpRequestBuilder);

            backendServiceHttpClient.sendHttpRequest(httpRequestBuilder.build());
        } catch (HttpClientClosedConnectionException httpClientClosedConnectionException) {

            errorCount.incrementAndGet();
            errorHandler.accept(httpClientClosedConnectionException);
            logger.error("Unable to forward request", httpClientClosedConnectionException);
            handleHttpClientErrorsForBackend(clientRequest, httpClientClosedConnectionException);
            backendServiceHttpClient = null;

            long timeSinceLastStart = time - lastHttpClientStart;
            if (timeSinceLastStart > 10_000) {
                checkClient();
            }

        } catch (Exception ex) {
            errorCount.incrementAndGet();
            errorHandler.accept(ex);
            logger.error("Unable to forward request", ex);
            handleHttpClientErrorsForBackend(clientRequest, ex);

            long timeSinceLastStart = time - lastHttpClientStart;
            if (timeSinceLastStart > 10_000) {
                checkClient();
            }

        }
    }
private void createBackEndRequestPopulateAndForward(final HttpRequest clientRequest) {
        try {

            if (backendServiceHttpClient == null) {
                handleHttpClientErrorsForBackend(clientRequest, new HttpClientClosedConnectionException("Not connected"));
                long timeSinceLastStart = time - lastHttpClientStart;
                if (timeSinceLastStart > 10_000) {
                    checkClient();
                }
                return;
            }
    /* forward request to backend client. */
            final HttpRequestBuilder httpRequestBuilder = HttpRequestBuilder.httpRequestBuilder()
                    .copyRequest(clientRequest).setBinaryReceiver(new HttpBinaryReceiver() {
                        @Override
                        public void response(final int code,
                                             final String contentType,
                                             final byte[] body,
                                             final MultiMap<String, String> headers) {
                            handleBackendClientResponses(clientRequest, code, contentType, body, headers);
                        }

                        @Override
                        public void response(int code, String contentType, byte[] body) {
                            response(code, contentType, body, MultiMap.empty());
                        }
                    }).setErrorHandler(e -> handleHttpClientErrorsForBackend(clientRequest, e));

            /** Give user of the lib a chance to populate headers and such. */
            beforeSend.accept(httpRequestBuilder);

            backendServiceHttpClient.sendHttpRequest(httpRequestBuilder.build());
        } catch (HttpClientClosedConnectionException httpClientClosedConnectionException) {

            errorCount.incrementAndGet();
            errorHandler.accept(httpClientClosedConnectionException);
            logger.error("Unable to forward request", httpClientClosedConnectionException);
            handleHttpClientErrorsForBackend(clientRequest, httpClientClosedConnectionException);
            backendServiceHttpClient = null;

            long timeSinceLastStart = time - lastHttpClientStart;
            if (timeSinceLastStart > 10_000) {
                checkClient();
            }

        } catch (Exception ex) {
            errorCount.incrementAndGet();
            errorHandler.accept(ex);
            logger.error("Unable to forward request", ex);
            handleHttpClientErrorsForBackend(clientRequest, ex);

            long timeSinceLastStart = time - lastHttpClientStart;
            if (timeSinceLastStart > 10_000) {
                checkClient();
            }

        }
    }
private void createBackEndRequestPopulateAndForward ( final HttpRequest clientRequest ) { try { if ( backendServiceHttpClient == null ) { handleHttpClientErrorsForBackend ( clientRequest , new HttpClientClosedConnectionException ( "Not connected" ) ) ; long timeSinceLastStart = time - lastHttpClientStart ; if ( timeSinceLastStart > 10_000 ) { checkClient ( ) ; } return ; } /* forward request to backend client. */ final HttpRequestBuilder httpRequestBuilder = HttpRequestBuilder . httpRequestBuilder ( ) . copyRequest ( clientRequest ) . setBinaryReceiver ( new HttpBinaryReceiver ( ) { @ Override public void response ( final int code , final String contentType , final byte [ ] body , final MultiMap < String , String > headers ) { handleBackendClientResponses ( clientRequest , code , contentType , body , headers ) ; } @ Override public void response ( int code , String contentType , byte [ ] body ) { response ( code , contentType , body , MultiMap . empty ( ) ) ; } } ) . setErrorHandler ( e -> handleHttpClientErrorsForBackend ( clientRequest , e ) ) ; /** Give user of the lib a chance to populate headers and such. */ beforeSend . accept ( httpRequestBuilder ) ; backendServiceHttpClient . sendHttpRequest ( httpRequestBuilder . build ( ) ) ; } catch ( HttpClientClosedConnectionException httpClientClosedConnectionException ) { errorCount . incrementAndGet ( ) ; errorHandler . accept ( httpClientClosedConnectionException ) ; logger . error ( "Unable to forward request" , httpClientClosedConnectionException ) ; handleHttpClientErrorsForBackend ( clientRequest , httpClientClosedConnectionException ) ; backendServiceHttpClient = null ; long timeSinceLastStart = time - lastHttpClientStart ; if ( timeSinceLastStart > 10_000 ) { checkClient ( ) ; } } catch ( Exception ex ) { errorCount . incrementAndGet ( ) ; errorHandler . accept ( ex ) ; logger . error ( "Unable to forward request" , ex ) ; handleHttpClientErrorsForBackend ( clientRequest , ex ) ; long timeSinceLastStart = time - lastHttpClientStart ; if ( timeSinceLastStart > 10_000 ) { checkClient ( ) ; } } }
Creates a backend request from the client request and then forwards it.

@param clientRequest clientRequest
Creates a backend request from the client request and then forwards it .