Merge pull request #762 from khatwaniNikhil/BAEL-418-Changes

Fixed Failing EchoTest
This commit is contained in:
Jim Kerak
2016-10-21 19:16:27 -04:00
committed by GitHub
2 changed files with 24 additions and 9 deletions

View File

@@ -1,14 +1,15 @@
package com.baeldung.java.nio.selector;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.Selector;
import java.nio.channels.SelectionKey;
import java.nio.ByteBuffer;
import java.io.IOException;
import java.util.Set;
import java.util.Iterator;
import java.net.InetSocketAddress;
import java.util.Set;
public class EchoServer {
@@ -47,4 +48,15 @@ public class EchoServer {
}
}
}
}
public static Process start() throws IOException, InterruptedException {
String javaHome = System.getProperty("java.home");
String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
String classpath = System.getProperty("java.class.path");
String className = EchoServer.class.getCanonicalName();
ProcessBuilder builder = new ProcessBuilder(javaBin, "-cp", classpath, className);
return builder.start();
}
}