Code example for SocketException

0
		try { 
			if (socket!=null) {
				socket.setSoTimeout(1000);
				Log.d("ConnectionThread","set socket timeout to 1000");
			} 
			else throw new SocketException();
		} catch (SocketException e1) {
			Log.e("ConnectionThread","Couldnot set timeout for socket");
		} 
		InputStream is = null;
		try { 
			is = new BufferedInputStream(socket.getInputStream(), 4096);
			input = new LineReadingInputStream(is);
			Log.d("ConnectionThread","got input stream ");
			output = socket.getOutputStream();
			Log.d("ConnectionThread","got output stream ");
		} catch (IOException e) {
			Log.e("ConnectionThread","Couldn't acquire input and output streams",e);
		} 
		Log.d("ConnectionThread","connection started");
		isBluetooth = false;