Package java.net

Examples of java.net.SocketException


        config.setTrafficClass(1234);
        verify(socket).setTrafficClass(eq(1234));
        verifyNoMoreInteractions(socket);

        // handle error
        when(socket.getTrafficClass()).thenThrow(new SocketException("test"));
        try {
            config.getTrafficClass();
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
        }

        // handle error
        doThrow(new SocketException("test")).when(socket).setTrafficClass(eq(1234));
        try {
            config.setTrafficClass(1234);
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
View Full Code Here


        config.setKeepAlive(true);
        verify(socket).setKeepAlive(eq(true));
        verifyNoMoreInteractions(socket);

        // handle error
        when(socket.getKeepAlive()).thenThrow(new SocketException("test"));
        try {
            config.isKeepAlive();
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
        }

        // handle error
        doThrow(new SocketException("test")).when(socket).setKeepAlive(eq(true));
        try {
            config.setKeepAlive(true);
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
View Full Code Here

        config.setOobInline(true);
        verify(socket).setOOBInline(eq(true));
        verifyNoMoreInteractions(socket);

        // handle error
        when(socket.getOOBInline()).thenThrow(new SocketException("test"));
        try {
            config.isOobInline();
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
        }

        // handle error
        doThrow(new SocketException("test")).when(socket).setOOBInline(eq(true));
        try {
            config.setOobInline(true);
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
View Full Code Here

        config.setSoLinger(-1234);
        verify(socket).setSoLinger(eq(false), anyInt());
        verifyNoMoreInteractions(socket);

        // handle error
        when(socket.getSoLinger()).thenThrow(new SocketException("test"));
        try {
            config.getSoLinger();
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
        }

        // handle error
        doThrow(new SocketException("test")).when(socket).setSoLinger(eq(true), eq(1234));
        try {
            config.setSoLinger(1234);
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
View Full Code Here

    {
        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

               initCookie(input_cookie);

               // read the cookie first
               in.read(input_cookie, 0, input_cookie.length);
               if(!matchCookie(input_cookie))
                   throw new SocketException("ConnectionTable.Connection.readPeerAddress(): cookie sent by " +
                                             client_peer_addr + " does not match own cookie; terminating connection");
               // then read the version
               version=in.readShort();

               if(Version.compareTo(version) == false) {
View Full Code Here

       * this error can be ignored. We will let the callers distinguish this
       * from other exceptions if this is not a subclass of IOException.
       */
      if (e.getClass().equals(IOException.class)) {
        // "se" could be a new class in stead of SocketException.
        IOException se = new SocketException("Original Exception : " + e);
        se.initCause(e);
        /* Cange the stacktrace so that original trace is not truncated
         * when printed.*/
        se.setStackTrace(e.getStackTrace());
        throw se;
      }
      throw e;
    }

View Full Code Here

    }

    @Override
    public void flush()
    {
      throw new ResponseIOException(new SocketException(
        "Connection reset by peer: socket write error"));
    }
View Full Code Here

    }

    @Override
    public void write(byte[] array)
    {
      throw new ResponseIOException(new SocketException(
        "Connection reset by peer: socket write error"));
    }
View Full Code Here

    }

    @Override
    public void write(byte[] array, int offset, int length)
    {
      throw new ResponseIOException(new SocketException(
        "Connection reset by peer: socket write error"));
    }
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.