On Wed, 26 Jun 2024 16:11:52 GMT, Weijun Wang <wei...@openjdk.org> wrote:

>> test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Default.java 
>> line 80:
>> 
>>> 78:         pipedOut.write("-1\n".getBytes());
>>> 79:         pipedOut.flush();
>>> 80:         textHandler.handle(new Callback[]{callback});
>> 
>> Can you handle 2 `Callback`s in a single `handle` call?
>
> Try if this class works for you. 
> https://github.com/openjdk/jdk/blob/45a616a891e4a4b0e77b1f2fa040522f4a99d172/test/jdk/sun/security/tools/keytool/KeyToolTest.java#L1885

@wangweij 
I was handling the callback in 2 separate calls because it was blocking and 
timing out while waiting for input. Now, using _HumanInputStream_ allows 
handling it in a single call. Unfortunately this class is not visible for this 
jteg test. To compile it properly, I would need to include the following 
annotations in the test:

 * @modules java.base/sun.security.tools.keytool
 *          java.base/sun.security.util
 *          java.base/sun.security.x509
 * @compile ../../../../../../sun/security/tools/keytool/KeyToolTest.java

 But, this would couple both tests together. would it be useful extracting 
HumanInputStream into a common library class?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19790#discussion_r1656856262

Reply via email to