@Test(expected = SocketTimeoutException.class) public void testConnect() throws Exception { new UDTSocket().connect(new InetSocketAddress("localhost", 11111), 1000); }
@Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { final CountDownLatch signal = new CountDownLatch(1); final Thread t = threadFactory.newThread(new Runnable() { @Override public void run() { try { connect(endpoint); } catch(IOException e) { exception = e; } finally { signal.countDown(); } } }); t.start(); try { if(!signal.await(timeout, TimeUnit.MILLISECONDS)) { throw new SocketTimeoutException(); } } catch(InterruptedException e) { final SocketTimeoutException s = new SocketTimeoutException(e.getMessage()); s.initCause(e); throw s; } if(exception != null) { throw exception; } }
UDTSocket extends NetSocketUDT { @Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { final CountDownLatch signal = new CountDownLatch(1); final Thread t = threadFactory.newThread(new Runnable() { @Override public void run() { try { connect(endpoint); } catch(IOException e) { exception = e; } finally { signal.countDown(); } } }); t.start(); try { if(!signal.await(timeout, TimeUnit.MILLISECONDS)) { throw new SocketTimeoutException(); } } catch(InterruptedException e) { final SocketTimeoutException s = new SocketTimeoutException(e.getMessage()); s.initCause(e); throw s; } if(exception != null) { throw exception; } } }
UDTSocket extends NetSocketUDT { @Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { final CountDownLatch signal = new CountDownLatch(1); final Thread t = threadFactory.newThread(new Runnable() { @Override public void run() { try { connect(endpoint); } catch(IOException e) { exception = e; } finally { signal.countDown(); } } }); t.start(); try { if(!signal.await(timeout, TimeUnit.MILLISECONDS)) { throw new SocketTimeoutException(); } } catch(InterruptedException e) { final SocketTimeoutException s = new SocketTimeoutException(e.getMessage()); s.initCause(e); throw s; } if(exception != null) { throw exception; } } UDTSocket(); }
UDTSocket extends NetSocketUDT { @Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { final CountDownLatch signal = new CountDownLatch(1); final Thread t = threadFactory.newThread(new Runnable() { @Override public void run() { try { connect(endpoint); } catch(IOException e) { exception = e; } finally { signal.countDown(); } } }); t.start(); try { if(!signal.await(timeout, TimeUnit.MILLISECONDS)) { throw new SocketTimeoutException(); } } catch(InterruptedException e) { final SocketTimeoutException s = new SocketTimeoutException(e.getMessage()); s.initCause(e); throw s; } if(exception != null) { throw exception; } } UDTSocket(); @Override void connect(final SocketAddress endpoint, final int timeout); @Override void setSoLinger(final boolean on, final int linger); }
UDTSocket extends NetSocketUDT { @Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { final CountDownLatch signal = new CountDownLatch(1); final Thread t = threadFactory.newThread(new Runnable() { @Override public void run() { try { connect(endpoint); } catch(IOException e) { exception = e; } finally { signal.countDown(); } } }); t.start(); try { if(!signal.await(timeout, TimeUnit.MILLISECONDS)) { throw new SocketTimeoutException(); } } catch(InterruptedException e) { final SocketTimeoutException s = new SocketTimeoutException(e.getMessage()); s.initCause(e); throw s; } if(exception != null) { throw exception; } } UDTSocket(); @Override void connect(final SocketAddress endpoint, final int timeout); @Override void setSoLinger(final boolean on, final int linger);  }