Path: blob/master/test/jdk/javax/net/ssl/TLSCommon/interop/AbstractServer.java
41154 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.io.IOException;24import java.nio.file.Path;25import java.nio.file.Paths;2627/*28* An abstract server.29*/30public abstract class AbstractServer extends AbstractPeer implements Server {3132@Override33protected void printLog() throws IOException {34System.out.println("---------- Server log start ----------");35super.printLog();36System.out.println("---------- Server log end ----------");37}3839/*40* Generally, server outputs logs to a separated file.41* For some cases, this file could be used as a synchronizer between42* server and client.43*/44@Override45public Path getLogPath() {46return Paths.get("server.log");47}4849@Override50public void signalStop() throws Exception { }5152public static abstract class Builder extends AbstractPeer.Builder {5354private int port;5556// Indicates if requires client authentication.57private boolean clientAuth = true;5859public int getPort() {60return port;61}6263public Builder setPort(int port) {64this.port = port;65return this;66}6768public boolean getClientAuth() {69return clientAuth;70}7172public Builder setClientAuth(boolean clientAuth) {73this.clientAuth = clientAuth;74return this;75}7677public abstract AbstractServer build() throws Exception;78}79}808182