Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0f080bcf
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0f080bcf
编写于
5月 23, 2016
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
ae7bca48
0928d703
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
80 addition
and
54 deletion
+80
-54
.hgtags
.hgtags
+1
-0
test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java
...rity/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java
+22
-10
test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java
...rity/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java
+44
-33
test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java
...curity/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java
+13
-11
未找到文件。
.hgtags
浏览文件 @
0f080bcf
...
...
@@ -594,6 +594,7 @@ f6cc9dbb5db5883385c91bb71ca02081220aaf3d jdk8u81-b00
25934d0d38fe10383ff22eb3f39bf5e8b9e73ac9 jdk8u101-b03
ebc56c2e803597ef409a5296addc986b390d934d jdk8u101-b04
c387bd2fb7db40467bd9aa803c8510a04ca32bae jdk8u101-b05
a15cdf2e91e7c2d71510280b31ae11048fb2f31e jdk8u101-b06
39baa472e20c13c0eb1243eb5dce589e82f78143 jdk8u76-b00
6ea3aea950d19d803475b3f4d704a2942e71b302 jdk8u76-b01
4de4cffb5988cd68959ce4bbd14c6d4547078c91 jdk8u76-b02
...
...
test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java
浏览文件 @
0f080bcf
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
6
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -35,6 +35,7 @@ import java.io.*;
import
java.net.*
;
import
javax.net.ssl.*
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.security.KeyStore
;
public
class
SSLCtxAccessToSessCtx
{
...
...
@@ -63,7 +64,7 @@ public class SSLCtxAccessToSessCtx {
/*
* Is the server ready to serve?
*/
volatile
static
boolean
serverReady
=
false
;
AtomicInteger
serverReady
=
new
AtomicInteger
(
1
);
// only one port now
/*
* Turn on SSL debugging?
...
...
@@ -89,12 +90,13 @@ public class SSLCtxAccessToSessCtx {
SSLServerSocket
sslServerSocket
=
(
SSLServerSocket
)
sslssf
.
createServerSocket
(
serverPort
);
serverPorts
[
createdPorts
++]
=
sslServerSocket
.
getLocalPort
();
int
slot
=
createdPorts
.
getAndIncrement
();
serverPorts
[
slot
]
=
sslServerSocket
.
getLocalPort
();
/*
* Signal Client, we're ready for his connect.
*/
serverReady
=
true
;
serverReady
.
getAndDecrement
()
;
int
read
=
0
;
SSLSocket
sslSocket
=
(
SSLSocket
)
sslServerSocket
.
accept
();
InputStream
sslIS
=
sslSocket
.
getInputStream
();
...
...
@@ -121,7 +123,7 @@ public class SSLCtxAccessToSessCtx {
/*
* Wait for server to get started.
*/
while
(
!
serverReady
)
{
while
(
serverReady
.
get
()
>
0
)
{
Thread
.
sleep
(
50
);
}
/*
...
...
@@ -151,8 +153,8 @@ public class SSLCtxAccessToSessCtx {
* The remainder is just support stuff
*/
volatile
int
serverPorts
[]
=
new
int
[]{
0
};
volatile
int
createdPorts
=
0
;
int
serverPorts
[]
=
new
int
[]{
0
};
// only one port at present
AtomicInteger
createdPorts
=
new
AtomicInteger
(
0
)
;
static
SSLServerSocketFactory
sslssf
;
static
SSLSocketFactory
sslsf
;
static
SSLContext
sslctx
;
...
...
@@ -255,14 +257,20 @@ public class SSLCtxAccessToSessCtx {
*/
System
.
err
.
println
(
"Server died..."
);
e
.
printStackTrace
();
serverReady
=
true
;
serverReady
.
set
(
0
)
;
serverException
=
e
;
}
}
};
serverThread
.
start
();
}
else
{
doServerSide
(
port
);
try
{
doServerSide
(
port
);
}
catch
(
Exception
e
)
{
serverException
=
e
;
}
finally
{
serverReady
.
set
(
0
);
}
}
}
...
...
@@ -284,7 +292,11 @@ public class SSLCtxAccessToSessCtx {
};
clientThread
.
start
();
}
else
{
doClientSide
();
try
{
doClientSide
();
}
catch
(
Exception
e
)
{
clientException
=
e
;
}
}
}
}
test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java
浏览文件 @
0f080bcf
/*
* Copyright (c) 2001, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
6
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -28,7 +28,7 @@
/*
* @test
* @bug
4366807
* @bug 4366807
* @summary Need new APIs to get/set session timeout and session cache size.
* @run main/othervm SessionCacheSizeTests
*/
...
...
@@ -108,36 +108,47 @@ public class SessionCacheSizeTests {
void
doServerSide
(
int
serverPort
,
int
serverConns
)
throws
Exception
{
SSLServerSocket
sslServerSocket
=
(
SSLServerSocket
)
sslssf
.
createServerSocket
(
serverPort
);
serverPorts
[
createdPorts
++]
=
sslServerSocket
.
getLocalPort
();
try
(
SSLServerSocket
sslServerSocket
=
(
SSLServerSocket
)
sslssf
.
createServerSocket
(
serverPort
))
{
/*
* Signal Client, we're ready for his connect.
*/
if
(
createdPorts
==
serverPorts
.
length
)
{
serverReady
=
true
;
}
int
read
=
0
;
int
nConnections
=
0
;
/*
* Divide the max connections among the available server ports.
* The use of more than one server port ensures creation of more
* than one session.
*/
SSLSession
sessions
[]
=
new
SSLSession
[
serverConns
];
SSLSessionContext
sessCtx
=
sslctx
.
getServerSessionContext
();
while
(
nConnections
<
serverConns
)
{
SSLSocket
sslSocket
=
(
SSLSocket
)
sslServerSocket
.
accept
();
InputStream
sslIS
=
sslSocket
.
getInputStream
();
OutputStream
sslOS
=
sslSocket
.
getOutputStream
();
read
=
sslIS
.
read
();
sessions
[
nConnections
]
=
sslSocket
.
getSession
();
sslOS
.
write
(
85
);
sslOS
.
flush
();
sslSocket
.
close
();
nConnections
++;
// timeout to accept a connection
sslServerSocket
.
setSoTimeout
(
45000
);
// make sure createdPorts++ is atomic
synchronized
(
serverPorts
)
{
serverPorts
[
createdPorts
++]
=
sslServerSocket
.
getLocalPort
();
/*
* Signal Client, we're ready for his connect.
*/
if
(
createdPorts
==
serverPorts
.
length
)
{
serverReady
=
true
;
}
}
int
read
=
0
;
int
nConnections
=
0
;
/*
* Divide the max connections among the available server ports.
* The use of more than one server port ensures creation of more
* than one session.
*/
SSLSession
sessions
[]
=
new
SSLSession
[
serverConns
];
SSLSessionContext
sessCtx
=
sslctx
.
getServerSessionContext
();
while
(
nConnections
<
serverConns
)
{
try
(
SSLSocket
sslSocket
=
(
SSLSocket
)
sslServerSocket
.
accept
())
{
sslSocket
.
setSoTimeout
(
90000
);
// timeout to read
InputStream
sslIS
=
sslSocket
.
getInputStream
();
OutputStream
sslOS
=
sslSocket
.
getOutputStream
();
read
=
sslIS
.
read
();
sessions
[
nConnections
]
=
sslSocket
.
getSession
();
sslOS
.
write
(
85
);
sslOS
.
flush
();
nConnections
++;
}
}
}
}
...
...
@@ -263,8 +274,8 @@ public class SessionCacheSizeTests {
* Using four ports (one per each connection), we are able to create
* alteast four sessions.
*/
volatile
int
serverPorts
[]
=
new
int
[]{
0
,
0
,
0
,
0
};
volatile
int
createdPorts
=
0
;
int
serverPorts
[]
=
new
int
[]{
0
,
0
,
0
,
0
};
// MAX_ACTIVE_CONNECTIONS: 4
int
createdPorts
=
0
;
static
SSLServerSocketFactory
sslssf
;
static
SSLSocketFactory
sslsf
;
static
SSLContext
sslctx
;
...
...
test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java
浏览文件 @
0f080bcf
/*
* Copyright (c) 2001, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
6
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -36,6 +36,7 @@ import java.net.*;
import
javax.net.ssl.*
;
import
java.util.*
;
import
java.security.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* Session reuse time-out tests cover the cases below:
...
...
@@ -79,7 +80,7 @@ public class SessionTimeOutTests {
/*
* Is the server ready to serve?
*/
volatile
static
int
serverReady
=
PORTS
;
AtomicInteger
serverReady
=
new
AtomicInteger
(
PORTS
)
;
/*
* Turn on SSL debugging?
...
...
@@ -98,7 +99,7 @@ public class SessionTimeOutTests {
/*
* Define the server side of the test.
*
* If the server prematurely exits, serverReady will be set to
true
* If the server prematurely exits, serverReady will be set to
zero
* to avoid infinite hangs.
*/
...
...
@@ -111,12 +112,13 @@ public class SessionTimeOutTests {
SSLServerSocket
sslServerSocket
=
(
SSLServerSocket
)
sslssf
.
createServerSocket
(
serverPort
);
serverPorts
[
createdPorts
++]
=
sslServerSocket
.
getLocalPort
();
int
slot
=
createdPorts
.
getAndIncrement
();
serverPorts
[
slot
]
=
sslServerSocket
.
getLocalPort
();
/*
* Signal Client, we're ready for his connect.
*/
serverReady
--
;
serverReady
.
getAndDecrement
()
;
int
read
=
0
;
int
nConnections
=
0
;
SSLSession
sessions
[]
=
new
SSLSession
[
serverConns
];
...
...
@@ -137,7 +139,7 @@ public class SessionTimeOutTests {
/*
* Define the client side of the test.
*
* If the server prematurely exits, serverReady will be set to
true
* If the server prematurely exits, serverReady will be set to
zero
* to avoid infinite hangs.
*/
void
doClientSide
()
throws
Exception
{
...
...
@@ -145,7 +147,7 @@ public class SessionTimeOutTests {
/*
* Wait for server to get started.
*/
while
(
serverReady
>
0
)
{
while
(
serverReady
.
get
()
>
0
)
{
Thread
.
sleep
(
50
);
}
...
...
@@ -287,8 +289,8 @@ public class SessionTimeOutTests {
* The remainder is just support stuff
*/
volatile
int
serverPorts
[]
=
new
int
[
PORTS
];
volatile
int
createdPorts
=
0
;
int
serverPorts
[]
=
new
int
[
PORTS
];
AtomicInteger
createdPorts
=
new
AtomicInteger
(
0
)
;
static
SSLServerSocketFactory
sslssf
;
static
SSLSocketFactory
sslsf
;
static
SSLContext
sslctx
;
...
...
@@ -447,7 +449,7 @@ public class SessionTimeOutTests {
*/
System
.
err
.
println
(
"Server died..."
);
e
.
printStackTrace
();
serverReady
=
0
;
serverReady
.
set
(
0
)
;
serverException
=
e
;
}
}
...
...
@@ -459,7 +461,7 @@ public class SessionTimeOutTests {
}
catch
(
Exception
e
)
{
serverException
=
e
;
}
finally
{
serverReady
=
0
;
serverReady
.
set
(
0
)
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录