Adding a check for NPN implementation in SpdyServer example.

This commit is contained in:
Daniel Bevenius 2014-03-01 14:08:36 +01:00
parent 94bcbba324
commit ad83a079cd

View File

@ -67,6 +67,7 @@ public class SpdyServer {
}
public static void main(String[] args) throws Exception {
checkForNpnSupport();
int port;
if (args.length > 0) {
port = Integer.parseInt(args[0]);
@ -80,4 +81,16 @@ public class SpdyServer {
new SpdyServer(port).run();
}
private static void checkForNpnSupport() {
try {
Class.forName("sun.security.ssl.NextProtoNegoExtension");
} catch (ClassNotFoundException ignored) {
System.err.println("\nCould not locate Next Protocol Negotiation (NPN) implementation.");
System.err.println("The NPN jar should have been made available when building the examples with maven.");
System.err.println("Please check that your JDK is among those supported by Jetty-NPN:");
System.err.println("http://wiki.eclipse.org/Jetty/Feature/NPN#Versions\n");
throw new IllegalStateException("Could not locate NPN implementation. See console err for details.");
}
}
}