Code example for FileDescriptor

		Method setInt;
		int fdint = pfd.getFd();
		try { 
			setInt = FileDescriptor.class.getDeclaredMethod("setInt$",int.class);
			FileDescriptor fdtosend = new FileDescriptor();
			FileDescriptor[] fds = {fdtosend};
			Log.d("Openvpn", "Sending FD tosocket: " + fdtosend + " " + fdint + "  " + pfd);
			// Trigger a send so we can close the fd on our side of the channel 
			// The API documentation fails to mention that it will not reset the file descriptor to 
			// be send and will happily send the file descriptor on every write ... 
			String cmd = String.format("needok '%s' %s\n", needed, "ok");
			// Set the FileDescriptor to null to stop this mad behavior  
Connect your IDE to all the code out there  Get Codota for Java