Ad-hoc is not natively supported by Android. But starting with Android 4.0 (Ice Cream Sandwich), a new feature called WiFi Direct was introduced:
Wi-Fi Direct, previously known as Wi-Fi P2P, is a standard that allows Wi-Fi devices to connect to each other without the need for a wireless access point. This allows Wi-Fi Direct devices to directly transfer data between each other with greatly reduced setup.
Support for Wi-Fi Direct lets users connect directly to nearby peer devices over Wi-Fi, for more reliable, higher-speed communication. No internet connection or tethering is needed. Through third-party apps, users can connect to compatible devices to take advantage of new features such as instant sharing of files, photos, or other media; streaming video or audio from another device; or connecting to compatible printers or other devices.
To me, this looks like what you are asking for: directly connecting two Android devices via WiFi without the need of a "mediator".