@Test public void timoutOnConnection() throws Exception { StreamConnector sca = new StreamConnector(); BitrustedConnector connector = new BitrustedConnector( TestKeys.privateKey(0), sca.getInputStream(), new ByteArrayOutputStream() ); connector.setHandshakeTimeoutMillis(10); try { connector.connect(null); fail("must throw TimeoutException"); } catch (TimeoutException x) { // all ok } }