JHttpTunnel

JHttpTunnel is the implementation of GNU httptunnel's protocol in pure Java.

Why JHttpTunnel?

Our initial motivation for developing JHttpTunnel was to free users from the cage made of HTTP on the mobile platform based on J2ME. We have believed the protocol of GNU httptunnel may be a key for it. GNU httptunnel is written and maintained by Lars Brinkhoff and its web page says as follows,

httptunnel creates a bidirectional virtual data connection tunnelled in HTTP requests. The HTTP requests can be sent via an HTTP proxy if so desired. This can be useful for users behind restrictive firewalls. If WWW access is allowed through a HTTP proxy, it's possible to use httptunnel and, say, telnet or PPP to connect to a computer outside the firewall.

The protocol of GNU httptunnel has been described in HACKING file included in its distribution archive.

Features

The current JHttpTunnel has the following features.

How To Use

Suppose your Java program has the following lines,

  Socket socket=new Socket(host, port);
  InputStream in=socket.getInputStream();
  OutputStream out=socket.getOutputStream();

You can replace them with the following lines,

  JHttpTunnelClient jhtc=new JHttpTunnelClient(remote_host, remote_port);
  //jhtc.setProxy(proxy_host, proxy_port);
  jhtc.setInBound(new InBoundSocket());
  jhtc.setOutBound(new OutBoundSocket());
  jhtc.connect();
  InputStream in=jhtc.getInputStream();
  OutputStream out=jhtc.getOutputStream();

if you have already run 'hts' of GNU httptunnel on the host 'remote_host' with the following options,

  hts -F host:port remote_port

Please refer to JHTC.java, which works like 'htc' of GNU httptunnel and will be a good example to learn how to use JHttpTunnel's API.

SSH Over HttpTunnel in Java

We have enjoyed SSH over HttpTunnel in pure Java by using JSch. Please refer to JSchOverJHttpTunnel.java as an example.

JHttpTunnel for J2ME/CLDC/MIDP

We have confirmed that the current version works on the J2ME/CLDC/MIDP environment included in Sun's Wireless Toolkit 2.2. Use 'com.jcraft.jhttptunnel.InBoundConnection' and 'com.jcraft.jhttptunnel.OutBoundConnection' and then apply the patch 'misc/httptunnel-3.0.5-0.0.3.patch' for GNU HttpTunnel 3.0.5. At present, we have following examples.

JHttpTunnel for J2ME/CLDC/DoJa

DoJa is yet another J2ME/CLDC profile and widely used in Japan. We have confirmed that JHttpTunnel can establish bi-directional streams from F900iC to the remote. It is still immature, but if you are interested in this hack, please refer to 'JHttpTunnel for J2ME/CLDC/DoJa' section in README.

Download

TODO

Credits and Acknowledgements

Comments/suggestions are accepted at jhttptunnel@jcraft.com.

``SSH is a registered trademark and Secure Shell is a trademark of SSH Communications Security Corp (www.ssh.com)''.