Request buildLocalTunnel(Tunnel tunnel, LaunchSession launchSession) throws IOException {
// Process destination host and port for replacement variables
VariableReplacement r = new VariableReplacement();
r.setLaunchSession(launchSession);
String destHost = r.replace(tunnel.getDestination().getHost());
ByteArrayWriter msg = new ByteArrayWriter();
msg.writeString(launchSession == null ? "" : launchSession.getId());
msg.writeInt(tunnel.getResourceId());
msg.writeString(tunnel.getResourceName());