private SafeDataInputStream resultToStream() { final SafeDataInputStream is = new SafeDataInputStream( new ByteArrayInputStream(this.os.toByteArray())); return is; }
@Override public ExitCode call() throws Exception { try (Socket clientSocket = this.socket.accept()) { try (BufferedInputStream bif = new BufferedInputStream( clientSocket.getInputStream())) { sendDataToMinion(clientSocket); final SafeDataInputStream is = new SafeDataInputStream(bif); return receiveResults(is); } catch (final IOException e) { throw Unchecked.translateCheckedException(e); } } finally { try { this.socket.close(); } catch (final IOException e) { throw Unchecked.translateCheckedException(e); } } }
public static void main(final String[] args) { LOG.log(Level.FINE, "minion started"); enablePowerMockSupport(); final int port = Integer.valueOf(args[0]); Socket s = null; try { s = new Socket("localhost", port); final SafeDataInputStream dis = new SafeDataInputStream( s.getInputStream()); final Reporter reporter = new DefaultReporter(s.getOutputStream()); addMemoryWatchDog(reporter); final ClientPluginServices plugins = new ClientPluginServices(IsolationUtils.getContextClassLoader()); final MinionSettings factory = new MinionSettings(plugins); final MutationTestMinion instance = new MutationTestMinion(factory, dis, reporter); instance.run(); } catch (final Throwable ex) { ex.printStackTrace(System.out); LOG.log(Level.WARNING, "Error during mutation test", ex); } finally { if (s != null) { safelyCloseSocket(s); } } }
s = new Socket("localhost", port); final SafeDataInputStream dis = new SafeDataInputStream( s.getInputStream());
@Test public void shouldBeAbletoReadLargeStrings() { final char[] chars = new char[65536]; Arrays.fill(chars, '!'); final String s = new String(chars); final ByteArrayOutputStream o = new ByteArrayOutputStream(); final SafeDataOutputStream dos = new SafeDataOutputStream(o); dos.writeString(s); final ByteArrayInputStream i = new ByteArrayInputStream(o.toByteArray()); final SafeDataInputStream dis = new SafeDataInputStream(i); final String actual = dis.readString(); assertEquals(s, actual); }
public static void main(final String[] args) { LOG.log(Level.FINE, "minion started"); enablePowerMockSupport(); final int port = Integer.valueOf(args[0]); Socket s = null; try { s = new Socket("localhost", port); final SafeDataInputStream dis = new SafeDataInputStream( s.getInputStream()); final Reporter reporter = new DefaultReporter(s.getOutputStream()); addMemoryWatchDog(reporter); final ClientPluginServices plugins = new ClientPluginServices(IsolationUtils.getContextClassLoader()); final MinionSettings factory = new MinionSettings(plugins); final MutationTestMinion instance = new MutationTestMinion(factory, dis, reporter); instance.run(); } catch (final Throwable ex) { ex.printStackTrace(System.out); LOG.log(Level.WARNING, "Error during mutation test", ex); } finally { if (s != null) { safelyCloseSocket(s); } } }
s = new Socket("localhost", port); final SafeDataInputStream dis = new SafeDataInputStream( s.getInputStream());