@Override
	public synchronized InputStream getInputStream() throws IOException
	{
		if(toAppStream == null) {
			toAppStream = new ConnectionEndPointInputStream();
			
			// if there is already some data, copy it to stream
			// and delete buffer
			if(toAppBuffer != null) {
				for(Object obj : toAppBuffer) {
					toAppStream.addToBuffer(obj);
				}
				
				toAppBuffer = null;
			}
		}

		return toAppStream;
	}