⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sslsocket.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            throw re;          }      }  }  public void setEnabledCipherSuites(String[] suites)  {    if (suites == null || suites.length == 0)      throw new IllegalArgumentException();    for (int i = 0; i < suites.length; i++)      if (CipherSuite.forName(suites[i]) == null)        throw new IllegalArgumentException("unsupported suite: " +                                           suites[i]);    synchronized (session.enabledSuites)      {        session.enabledSuites.clear();        for (int i = 0; i < suites.length; i++)          {            CipherSuite suite = CipherSuite.forName(suites[i]);            if (!session.enabledSuites.contains(suite))              {                session.enabledSuites.add(suite);              }          }      }  }  public String[] getSupportedCipherSuites()  {    return (String[]) CipherSuite.availableSuiteNames().toArray(new String[52]);  }  public SSLSession getSession()  {    return session;  }  public boolean getEnableSessionCreation()  {    return createSessions;  }  public void setEnableSessionCreation(boolean flag)  {    createSessions = flag;  }  public boolean getNeedClientAuth()  {    return needClientAuth;  }  public void setNeedClientAuth(boolean flag)  {    needClientAuth = flag;  }  public boolean getWantClientAuth()  {    return wantClientAuth;  }  public void setWantClientAuth(boolean flag)  {    wantClientAuth = flag;  }  public boolean getUseClientMode()  {    return clientMode;  }  public void setUseClientMode(boolean flag)  {    this.clientMode = flag;  }  public synchronized void startHandshake() throws IOException  {    if (DEBUG_HANDSHAKE_LAYER)      {        logger.log (Component.SSL_HANDSHAKE, "startHandshake called in {0}",                    Thread.currentThread());        handshakeTime = System.currentTimeMillis();      }    if (handshakeDone)      {        if (clientMode)          {            handshakeDone = false;            doClientHandshake();          }        else          {            Handshake req = new Handshake(Handshake.Type.HELLO_REQUEST, null);            req.write (handshakeOut, session.protocol);            handshakeOut.flush();//             recordOutput.setHandshakeAvail(req.write(handshakeOut, session.protocol));          }        return;      }    if (recordInput == null)      {        setupIO();      }    if (clientMode)      {        doClientHandshake();      }    else      {        doServerHandshake();      }  }// Socket methods.  // -------------------------------------------------------------------------  public InetAddress getInetAddress()  {    if (underlyingSocket != null)      {        return underlyingSocket.getInetAddress();      }    else      {        return super.getInetAddress();      }  }  public InetAddress getLocalAddress()  {    if (underlyingSocket != null)      {        return underlyingSocket.getLocalAddress();      }    else      {        return super.getLocalAddress();      }  }  public int getPort()  {    if (underlyingSocket != null)      {        return underlyingSocket.getPort();      }    else      {        return super.getPort();      }  }  public int getLocalPort()  {    if (underlyingSocket != null)      {        return underlyingSocket.getLocalPort();      }    else      {        return super.getLocalPort();      }  }  public InputStream getInputStream() throws IOException  {    if (applicationIn == null)      {        setupIO();      }    return applicationIn;  }  public OutputStream getOutputStream() throws IOException  {    if (applicationOut == null)      {        setupIO();      }    return applicationOut;  }  public void setTcpNoDelay(boolean flag) throws SocketException  {    if (underlyingSocket != null)      {        underlyingSocket.setTcpNoDelay(flag);      }    else      {        super.setTcpNoDelay(flag);      }  }  public boolean getTcpNoDelay() throws SocketException  {    if (underlyingSocket != null)      {        return underlyingSocket.getTcpNoDelay();      }    else      {        return super.getTcpNoDelay();      }  }  public void setSoLinger(boolean flag, int linger) throws SocketException  {    if (underlyingSocket != null)      {        underlyingSocket.setSoLinger(flag, linger);      }    else      {        super.setSoLinger(flag, linger);      }  }  public int getSoLinger() throws SocketException  {    if (underlyingSocket != null)      {        return underlyingSocket.getSoLinger();      }    else      {        return super.getSoLinger();      }  }  public void sendUrgentData(int data) throws IOException  {    throw new UnsupportedOperationException("not implemented");  }  public void setSoTimeout(int timeout) throws SocketException  {    if (underlyingSocket != null)      {        underlyingSocket.setSoTimeout(timeout);      }    else      {        super.setSoTimeout(timeout);      }  }  public int getSoTimeout() throws SocketException  {    if (underlyingSocket != null)      {        return underlyingSocket.getSoTimeout();      }    else      {        return super.getSoTimeout();      }  }  public void setSendBufferSize(int size) throws SocketException  {    if (underlyingSocket != null)      {        underlyingSocket.setSendBufferSize(size);      }    else      {        super.setSendBufferSize(size);      }  }  public int getSendBufferSize() throws SocketException  {    if (underlyingSocket != null)      {        return underlyingSocket.getSendBufferSize();      }    else      {        return super.getSendBufferSize();      }  }  public void setReceiveBufferSize(int size) throws SocketException  {    if (underlyingSocket != null)      {        underlyingSocket.setReceiveBufferSize(size);      }    else      {        super.setReceiveBufferSize(size);      }  }  public int getReceiveBufferSize() throws SocketException  {    if (underlyingSocket != null)      {        return underlyingSocket.getReceiveBufferSize();      }    else      {        return super.getReceiveBufferSize();      }  }  public synchronized void close() throws IOException  {    if (recordInput == null)      {        if (underlyingSocket != null)          {            if (autoClose)              underlyingSocket.close();          }        else          super.close();        return;      }//     while (recordOutput.applicationDataPending()) Thread.yield();    Alert close = new Alert (Alert.Level.WARNING, Alert.Description.CLOSE_NOTIFY);    sendAlert (close);    long wait = System.currentTimeMillis() + 60000L;    while (session.currentAlert == null && !recordInput.pollClose())      {        Thread.yield();        if (wait <= System.currentTimeMillis())          {            break;          }      }    boolean gotClose = session.currentAlert != null &&      session.currentAlert.getDescription() == Alert.Description.CLOSE_NOTIFY;//     recordInput.setRunning(false);//     recordOutput.setRunning(false);//     recordLayer.interrupt();    recordInput = null;//     recordOutput = null;//     recordLayer = null;    if (underlyingSocket != null)      {        if (autoClose)          underlyingSocket.close();      }    else      super.close();    if (!gotClose)      {        session.invalidate();        throw new SSLException("did not receive close notify");      }  }  public String toString()  {    if (underlyingSocket != null)      {        return SSLSocket.class.getName() + " [ " + underlyingSocket + " ]";      }    else      {        return SSLSocket.class.getName() + " [ " + super.toString() + " ]";      }  }  // Configuration insanity begins here.  public void connect(SocketAddress saddr) throws IOException  {    if (underlyingSocket != null)      {        underlyingSocket.connect(saddr);      }    else      {        super.connect(saddr);      }  }  public void connect(SocketAddress saddr, int timeout) throws IOException  {    if (underlyingSocket != null)      {        underlyingSocket.connect(saddr, timeout);      }    else      {        super.connect(saddr, timeout);      }  }  public void bind(SocketAddress saddr) throws IOException  {    if (underlyingSocket != null)      {        underlyingSocket.bind(saddr);      }    else      {        super.bind(saddr);      }  }  public SocketAddress getLocalSocketAddress()  {    if (underlyingSocket != null)      {        return underlyingSocket.getLocalSocketAddress();      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -