new MongoClient("localhost", 1111);
} catch (MongoSocketOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
You just have to name the appropriate exception in the catch block. This applies to any exception. You can add as many catch blocks for each unique exception