Effort has been underway for quite some time - by folks such as Vint Cerf, no less - to facilitate Internet over long delays. Surprisingly, there has been terrestrial (or aquatic) applications in the research as well, for example solar-powered sensor networks that can only transmit during daylight hours.
There's a nice overview architecture draft from 2003, especially interesting bits are in the routing section (12.3-12.4), see https://tools.ietf.org/html/dr... - the eventually published RFC https://tools.ietf.org/html/rf... has nowhere such interesting figures about routing between Earth and Mars
Anyway, the underlying arch is relying on putting a "bundle layer" between applications and transport, a layer 5 if you will - and the bundling will attempt to hide the long latencies. Naturally, for interactive applications this won't work, but for everything else why not...There are some implementations at http://www.dtnrg.org/wiki/Code.