Package java.net

Examples of java.net.SocketException


    {
        SSLSocket asock = null;
        try {
             asock = (SSLSocket)socket.accept();
        } catch (SSLException e){
          throw new SocketException("SSL handshake error" + e.toString());
        }
        return asock;
    }
View Full Code Here


     
      // Create client.
      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFactory(new SocketException(getName()), 2));
      addExtraClientConfig(clientConfig);
      Client client = new Client(clientLocator, clientConfig);
      client.connect();
      log.info("client is connected");
     
View Full Code Here

  private void waitForData(InputStream is, int bytes) throws IOException {
    long start = System.currentTimeMillis();
    while(true) {
      if(!isConnected())
        throw new SocketException("Socket closed");

      if(is.available() >= bytes)
        return;

      // Wait 5 seconds for the proxy to come up with the data
      if(System.currentTimeMillis() - start > 5000)
        throw new SocketException("SOCKS4 proxy unresponsive");

      Thread.yield();
    }
  }
View Full Code Here

        SSLSocket asock = null;
        try {
             asock = (SSLSocket)socket.accept();
             configureClientAuth(asock);
        } catch (SSLException e){
          throw new SocketException("SSL handshake error" + e.toString());
        }
        return asock;
    }
View Full Code Here

    public void testClosetMatch3() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new ConnectException(""));
        assertEquals(type3, result);

        result = strategy.getExceptionPolicy(policies, null, new SocketException(""));
        assertEquals(type3, result);

        result = strategy.getExceptionPolicy(policies, null, new FileNotFoundException());
        assertEquals(type3, result);
    }
View Full Code Here

   * disk errors.
   */
  private static IOException ioeToSocketException(IOException ioe) {
    if (ioe.getClass().equals(IOException.class)) {
      // "se" could be a new class in stead of SocketException.
      IOException se = new SocketException("Original Exception : " + ioe);
      se.initCause(ioe);
      /* Change the stacktrace so that original trace is not truncated
       * when printed.*/
      se.setStackTrace(ioe.getStackTrace());
      return se;
    }
    // otherwise just return the same exception.
    return ioe;
  }
View Full Code Here

    List proxyList1 = selector.select(httpUri);
    assertNotNull(proxyList1);
    assertEquals(1, proxyList1.size());
    Proxy proxy1 = (Proxy) proxyList1.get(0);
    selector
        .connectFailed(httpUri, proxy1.address(), new SocketException());

    List proxyList2 = selector.select(httpUri);
    assertNotNull(proxyList2);
    assertEquals(1, proxyList2.size());
    Proxy proxy2 = (Proxy) proxyList2.get(0);
View Full Code Here

   */
  public void test_connectionFailedLjava_net_URILjava_net_SocketAddressLjava_io_IOException_IllegalArguement()
      throws URISyntaxException {
    SocketAddress sa = InetSocketAddress.createUnresolved("127.0.0.1", 0);
    try {
      selector.connectFailed(null, sa, new SocketException());
      fail("should throw IllegalArgumentException if any argument is null.");
    } catch (IllegalArgumentException e) {
      // expected
    }
    try {
      selector.connectFailed(httpUri, null, new SocketException());
      fail("should throw IllegalArgumentException if any argument is null.");
    } catch (IllegalArgumentException e) {
      // expected
    }
    try {
View Full Code Here

 
  private ServerSocket checkSocket() throws IOException
  {
    ServerSocket ss = serverSocket;
    if (ss == null)
      throw new SocketException( "socket closed" );
    return ss;
  }
View Full Code Here

 
  private SSLServerSocket checkSocket() throws IOException
  {
    SSLServerSocket ss = sslServerSocket;
    if (ss == null)
      throw new SocketException( "socket closed" );
    return ss;
  }
View Full Code Here

TOP

Related Classes of java.net.SocketException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.