I would like to tell my Android that when I'm in a given app it should switch to a given keyboard. My use case is that I want to use Hacker keyboard with Connectbot.
You could use Tasker for this. In case you don't know it: Tasker is the most complete automation tool for Android, combining "conditions" with "tasks" to so-called "profiles". For your case, the Profile could look like this:
Condition: App (select Connectbot)
Task: Input Method Select
From the Tasker manual:
Show the Android Input Method picker dialog.
If some methods you have installed are not shown, make sure they are enabled in Android settings.
Note: unfortunately Android does not allow changing of the input method without user iteraction.
So from the last sentence you see, your final goal cannot be achieved. All you can get is the picker popping up, but you still have to pick your desired IME yourself. If you first want to try out whether that works for you, there's a 7-day trial version of Tasker available at their homepage.
AFAIK there is no any such option. I fear you will have to manually go and change the input settings every time. In case you are using Android 4.0 or above, whenever you have your keyboard on you will get an ongoing notification in the notification panel, you can tap on it to quickly switch between keyboards. If you cannot see your keyboard listed there, make sure you have it selected in Input settings. That's the best you can do.