Package java.net

Examples of java.net.SocketException


    }

    @Override
    protected int available() throws IOException {
        if (in == null) {
            throw new SocketException("socket is closed");
        }
        return in.available();
    }
View Full Code Here


    }

    @Override
    protected synchronized InputStream getInputStream() throws IOException {
        if (closed || in == null) {
            throw new SocketException("socket is closed");
        }
        return in;
    }
View Full Code Here

    }

    @Override
    protected synchronized OutputStream getOutputStream() throws IOException {
        if (closed || out == null) {
            throw new SocketException("socket is closed");
        }
        return out;
    }
View Full Code Here

                 asock.addHandshakeCompletedListener(
                         new DisableSslRenegotiation());
             }
             configureClientAuth(asock);
        } catch (SSLException e){
          throw new SocketException("SSL handshake error" + e.toString());
        }
        return asock;
    }
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

      IOException exception;
      int throwOn = -1;
     
      public TestSocketFactory()
      {
         exception = new SocketException("default");
      }
View Full Code Here

            }
         }
      }

      int retryCount = 0;
      SocketException sockEx = null;

      for (; retryCount < numberOfCallRetries; retryCount++)
      {
         // timeLeft < 0 will indicate that there is no per invocation timeout.
         int timeLeft = -1;
         if (0 < tempTimeout)
         {
            // If a per invocation timeout has been set, the time spent retrying
            // should count toward the elapsed time.
            timeLeft = (int) (tempTimeout - (System.currentTimeMillis() - start));
            if (timeLeft <= 0)
               break;
         }

         try
         {
            socketWrapper = getConnection(marshaller, unmarshaller, timeLeft);
         }
         catch (Exception e)
         {
//            if (bailOut)
//               return null;
            semaphore.release();
            if (trace) log.trace(this + " released semaphore: " + semaphore.permits());
            throw new CannotConnectException(
               "Can not get connection to server. Problem establishing " +
               "socket connection for " + locator, e);
         }

         if (tempTimeout >= 0)
         {
            savedTimeout = socketWrapper.getTimeout();
            socketWrapper.setTimeout((int) (tempTimeout - (System.currentTimeMillis() - start)));
         }

         long end = System.currentTimeMillis() - start;
         getSocketTime += end;

         try
         {
            int version = Version.getDefaultVersion();
            boolean performVersioning = Version.performVersioning();

            OutputStream outputStream = socketWrapper.getOutputStream();

            if (performVersioning)
            {
               writeVersion(outputStream, version);
            }

            //TODO: -TME so this is messed up as now ties remoting versioning to using a marshaller type
            versionedWrite(outputStream, marshaller, invocation, version);

            end = System.currentTimeMillis() - start;
            writeTime += end;
            start = System.currentTimeMillis();

            if (oneway)
            {
               if(trace) { log.trace(this + " sent oneway invocation, so not waiting for response, returning null"); }
            }
            else
            {
               InputStream inputStream = socketWrapper.getInputStream();
               if (performVersioning)
               {
                  version = readVersion(inputStream);
                  if (version == -1)
                  {
                     throw new SocketException("end of file");
                  }
                  if (version == SocketWrapper.CLOSING)
                  {
                     log.debug("Received version 254: treating as end of file");
                     throw new SocketException("end of file");
                  }
               }

               response = versionedRead(inputStream, unmarshaller, version);
            }
View Full Code Here

                break;
            }
        }
        ssl.setSoTimeout(oldTimeout);
        if (listener.completed == false) {
            throw new SocketException("SSL Cert handshake timeout");
        }

    }
View Full Code Here

      public void write(int b) throws IOException
      {
         if (closed)
         {
            log.info("TestOutputStream closed, cannot write");
            throw new SocketException("closed");
         }
         if (doCounterTest && ++counter > initialWrites)
         {
            close();
            throw new SocketException("closed");
         }
         os.write(b);
      }
View Full Code Here

         System.out.println("");
        
         if (closed)
         {
            log.info("TestOutputStream closed, cannot write");
            throw new SocketException("closed");
         }
         log.info("TestOutputStream: counter = " + counter + ", initialWrites = " + initialWrites);
         if (++counter > initialWrites)
         {
            close();
            throw new SocketException("closed");
         }
         try
         {
            log.info(this + " writing");
            doCounterTest = false;
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.