Handle client request , this method will be called when new client connection
received by the start method.

@param client the client
@throws IOException Signals that an I/O exception has occurred.
973854
protected void handleClient(final Socket client) throws IOException {
		final ClientHandler handler = new ClientHandler(client);
		this.executorService.execute(handler);
	}
89652
protected synchronized void connectionFailed (final IOException ioe)
    {
        // make sure the socket isn't already closed down (meaning we've already dealt with the
        // failed connection)
        if (_channel == null) {
            return;
        }

        log.info("Connection failed", ioe);

        // let the client know that things went south
        notifyClientObservers(new ObserverOps.Client(_client) {
            @Override protected void notify (ClientObserver obs) {
                obs.clientConnectionFailed(_client, ioe);
            }
        });

        // and request that we go through the motions of logging off
        logoff();
    }
470264
public static void initialize(KeenClient client) {
        if (client == null) {
            throw new IllegalArgumentException("Client must not be null");
        }

        if (ClientSingleton.INSTANCE.client != null) {
            // Do nothing.
            return;
        }

        ClientSingleton.INSTANCE.client = client;
    }
120392
private void setupClient(final AbstractHttpClient client) {
		this.client.addResponseInterceptor(new HttpResponseInterceptor() {
			@Override
			public void process(final HttpResponse response, final HttpContext context)
					throws HttpException, IOException {
				Header header = response.getFirstHeader("Location");
				if (header!=null)
					context.setAttribute("Location", header.getValue());
			}
		});
	}
942372
private void updateOtherClientDisconnected() throws IOException
    {
        final byte cid = in.readByte();
        final String cname = readString();
        for (final ConnectionListener listener : listeners)
        {
            listener.notifyClientDisconnected(Byte.valueOf(cid), cname);
        }
    }
1151102
public static HttpResponse execute(HttpRequestBase request) throws IOException {

		Assert.notNull(request, "Missing request!");
		HttpClient client = HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()).build();
		return client.execute(request);
	}
554080
public void handleRequest(String request) {
        if (messageListener != null) {
            log.debug("Received Http request");
            messageListener.onInboundMessage(new RawMessage(request), null);
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Received Http request:" + NEWLINE + request);
            }
        }
    }
1080710
void handleDisconnected() throws IOException {
		synchronized (this.asyncMutex) {
			if (socket != null) {
				socket.close();
			}
			this.socket = new Socket(server, port);
			this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
			this.out = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream()));
			
			this.listenThread = new SocketThread(this.in, this, this.resultParser, this.daemon);
			this.listenThread.start();
			if (lastWatch != null) { // restore watch if we had one.
				this.syncCommand(lastWatch, WatchObject.class);
			}
		}
		
	}
207049
public void doWithRequest(
                    final ClientHttpRequest request
                    )
    throws IOException
    {
        HttpHeaders  headers = request.getHeaders();
        headers.setContentType( _mediaType );

        long  size = IoUtil.copy( new StringReader( _string.toString() ),
                        new OutputStreamWriter( request.getBody() ) );
        headers.setContentLength( size );
    }
1157485
public void start() throws IOException {
		// try to automatically retrieve a port
		port = SocketUtils.getNextFreePort(PORT_RANGE_START, PORT_RANGE_END);

		server = SafeCloseSmtpServer.start(port);
	}
224034
@FFDCIgnore(value = { InterruptedException.class })
    public void checkinClient(Client client) {
        boolean done = false;

        //If no more space. Return. Shouldn't be checking more than we have. Shouldn't happen besides unit test anyways.
        if (clients.remainingCapacity() == 0) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Checking in more clients than there should be.");
            }
            return;
        }

        while (!done) {
            try {
                //check if this client was already checked-in.
                if (!clients.contains(client)) {
                    clients.putFirst(client);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                        int clientHash = (client != null) ? client.hashCode() : 0;
                        Tr.event(tc, "post-checkin  - (" + clientHash + ") " + (numClients - clients.remainingCapacity()) + " of " + numClients + " clients available.");
                    }
                }
                done = true;
            } catch (InterruptedException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    Tr.event(tc, "InterruptedException during checkin - will retry");
            }
        }

    }
898921
@Override
    public Response execute(Request request) throws IOException {
        HttpURLConnection connection = openConnection(request);
        sendRequest(connection, request);
        return readResponse(connection);
    }
1294153
function Client(client) {
  this._client = client;
  this.query = this.query.bind(this);
  this.end = this.end.bind(this);
}
1039374
public void setClient(HTTPClientPolicy client) {
        if (this.clientSidePolicy != null) {
            this.clientSidePolicy.removePropertyChangeListener(this);
        }
        this.clientSidePolicyCalced = true;
        this.clientSidePolicy = client;
        clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice
        clientSidePolicy.addPropertyChangeListener(this);
        endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto", client.getDecoupledEndpoint());
    }
1213450
@Override
	public void handleRequest(final Request request) {
		if (!isDisabled()) {
			final SelectToggleModel model = getComponentModel();
			String requestParam = request.getParameter(getId());

			final State newValue;
			if ("all".equals(requestParam)) {
				newValue = State.ALL;
			} else if ("none".equals(requestParam)) {
				newValue = State.NONE;
			} else if ("some".equals(requestParam)) {
				newValue = State.SOME;
			} else {
				newValue = model.state;
			}

			if (!newValue.equals(model.state)) {
				setState(newValue);
			}
			if (!model.clientSide && model.target != null && !State.SOME.equals(newValue)) {
				// We need to change the selections *after* all components
				// Have updated themselves from the request, as they may change
				// their values when their handleRequest methods are called.
				invokeLater(new Runnable() {
					@Override
					public void run() {
						setSelections(model.target, State.ALL.equals(newValue));
					}
				});
			}
		}
	}
941159
@Override
  public void flush() throws IOException
  {
    if (_os == null || ! _needsFlush)
      return;

    _needsFlush = false;
    try {
      _os.flush();
    } catch (IOException e) {
      try {
        close();
      } catch (IOException e1) {
      }
      
      throw ClientDisconnectException.create(e);
    }
  }
388713
public synchronized void waitForStart()
	throws ServerException,
	       ClientException,
	       IOException {
	    try {
	        while(!isStarted() && !hasError()) {
		        wait();
	        }
	    } catch(InterruptedException e) {
            // break
	    }
	    checkError();
    }