< prev index next >
test/jdk/javax/net/ssl/compatibility/Server.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -118,11 +118,11 @@
"AppProtocols=" + appProtocols));
Status status = Status.SUCCESS;
Server server = null;
try {
- server = new Server(Cert.getCerts(cipherSuite));
+ server = new Server(Cert.getCerts(CipherSuite.cipherSuite(cipherSuite)));
System.out.println("port=" + server.getPort());
server.setNeedClientAuth(clientAuth);
server.setEnabledProtocols(protocol);
server.setEnabledCipherSuites(cipherSuite);
if (appProtocols != null) {
@@ -144,20 +144,24 @@
} finally {
if (server != null) {
server.close();
}
- // Cleanups port log.
- if (!new File(Utils.PORT_LOG).delete()) {
- throw new RuntimeException("Cannot delete port log");
- }
+ deletePortFile();
}
System.out.println("STATUS: " + status);
System.out.println("----- Server end -----");
}
+ private static void deletePortFile() {
+ File portFile = new File(Utils.PORT_LOG);
+ if (portFile.exists() && !portFile.delete()) {
+ throw new RuntimeException("Cannot delete port log");
+ }
+ }
+
private static void savePort(int port) throws IOException {
FileWriter writer = null;
try {
writer = new FileWriter(new File(Utils.PORT_LOG));
writer.write(port + "");
< prev index next >