Code example for CharArrayBuffer

Methods: indexOf, substringTrimmed, toString

0
	public void init() { 
		try { 
			socket = new ServerSocket(port, 0,
					InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
			socket.setSoTimeout(5000);
			port = socket.getLocalPort();
			Log.d(LOG_TAG, "port " + port + " obtained");
		} catch (UnknownHostException e) {
			Log.e(LOG_TAG, "Error initializing server", e);
		} catch (IOException e) {
			Log.e(LOG_TAG, "Error initializing server", e);
		} 
	} 
 
	public void start() { 
 
		serviceStatusAvailable = true;
		if (socket == null) {
			throw new IllegalStateException(
					"Cannot start proxy; it has not been initialized."); 
		}