static DialogIO talkToSubBot(final long vport, final DialogIO io) { ret talkToSubBot(String.valueOf(vport), io); } static DialogIO talkToSubBot(final S subBot, final DialogIO io) { if (subBot == null) ret io; ret new DialogIO() { // delegate all but sendLine boolean isStillConnected() { ret io.isStillConnected(); } String readLineImpl() { ret io.readLineImpl(); } boolean isLocalConnection() { ret io.isLocalConnection(); } Socket getSocket() { ret io.getSocket(); } void close() { io.close(); } void sendLine(String line) { io.sendLine(format3("please forward to bot *: *", subBot, line)); } }; }