Package java.net

Examples of java.net.SocketException


   * @see #doQuit(String)
   * @see #close()
   */
  public void connect() throws IOException {
    if (level != 0) // otherwise disconnected or connect
      throw new SocketException("Socket closed or already open ("+ level +")");
    IOException exception = null;
    SSLSocketFactory sf = null;
    SSLSocket s = null;
    for (int i = 0; i < ports.length && s == null; i++) {
      try {
View Full Code Here


   * @see #doQuit(String)
   * @see #close()
   */
  public void connect() throws IOException {
    if (level != 0) // otherwise disconnected or connect
      throw new SocketException("Socket closed or already open ("+ level +")");
    IOException exception = null;
    Socket s = null;
    for (int i = 0; i < ports.length && s == null; i++) {
      try {
        s = new Socket(host, ports[i]);
View Full Code Here

   * @see #connect()
   * @see #run()
   */
  protected void prepare(Socket s) throws IOException {
    if (s == null)
      throw new SocketException("Socket s is null, not connected");
    socket = s;
    level = 1;
    s.setSoTimeout(timeout);
    in  = new BufferedReader(new InputStreamReader(s.getInputStream(),
        encoding));
View Full Code Here

        handler.setRequestStartTime();

        // Get header data (eg protocol, method, uri, headers, etc)
        String uriLine = new String(uriBuffer);
        if (uriLine.trim().equals(""))
            throw new SocketException("Empty URI Line");
        String servletURI = parseURILine(uriLine, req, rsp);
        parseHeaders(req, inData);
        rsp.extractRequestKeepAliveHeader(req);
        int contentLength = req.getContentLength();
        if (contentLength != -1)
View Full Code Here

            tryPort = m_jvmPortMin;
            fixedPort = false;
        }
       
        // Loop until we find a port we can connect using.
        SocketException causeException = null;
        do
        {
            try
            {
                m_backendSocket = new Socket( iNetAddress, m_port, iNetAddress, tryPort );
View Full Code Here

//      this.setSocketFactory(new SOSSSLSocketFactory());
      try {
        super.connect(ftpHost, ftpPort1);
      }
      catch (NullPointerException e) {
        throw new SocketException("Connect failed! Probably HTTP proxy in use or the entered ftps port is invalid: " + e.toString());
      }
      catch (Exception e) {
        e.printStackTrace();
        throw new SocketException("Connect failed, reason: " + e.toString());
      }
      this.sendCommand("PBSZ 0");
      this.sendCommand("PROT P");
      this.enterLocalPassiveMode();
    }
View Full Code Here

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

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

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

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

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

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

        config.setReadBufferSize(1234);
        verify(socket).setReceiveBufferSize(eq(1234));
        verifyNoMoreInteractions(socket);

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

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

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

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

        // handle error
        doThrow(new SocketException("test")).when(socket).setSendBufferSize(eq(1234));
        try {
            config.setSendBufferSize(1234);
            fail();
        } catch (ConfigurationException e) {
            assertEquals("test", e.getCause().getMessage());
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.