@Override
  public void handle(Callback[] callbacks) throws UnsupportedCallbackException, IOException {
    for (Callback callBack : callbacks) {
      if (callBack instanceof NameCallback nameCallback) {
        // Handles username callback
        nameCallback.setName(name);
      } else if (callBack instanceof PasswordCallback passwordCallback) {
        // Handles password callback
        passwordCallback.setPassword(password.toCharArray());
      } else {
        throw new UnsupportedCallbackException(callBack, "Callback not supported");
      }
    }
  }
@Test
  public void unsupportedCallback() {
    assertThatThrownBy(() -> {
      new CallbackHandlerImpl("tester", "secret").handle(new Callback[] {mock(Callback.class)});
    })
      .isInstanceOf(UnsupportedCallbackException.class);
  }