private void sendAndReceive(HttpTunnelPayload payload) throws IOException { ClientHttpRequest request = createRequest(payload != null); if (payload != null) { payload.logIncoming(); payload.assignTo(request); } handleResponse(request.execute()); }
private void handleResponse(ClientHttpResponse response) throws IOException { if (response.getStatusCode() == HttpStatus.GONE) { close(); return; } if (response.getStatusCode() == HttpStatus.SERVICE_UNAVAILABLE) { logger.warn( "Remote application responded with service unavailable. Did " + "you forget to start it with remote debugging enabled?"); close(); return; } if (response.getStatusCode() == HttpStatus.OK) { HttpTunnelPayload payload = HttpTunnelPayload.get(response); if (payload != null) { this.forwarder.forward(payload); } } if (response.getStatusCode() != HttpStatus.TOO_MANY_REQUESTS) { openNewConnection(null); } }