* <p>
* Will only flush the data if there is contentToSend.
*
- * @return the answer (which can be NULL)
+ * @return the answer (which can be NULL if no more content)
*
* @throws IOException
* in case of I/O error
}
/**
- * Read a possibly encrypted line.
+ * Read a possibly encrypted line, or NULL if no more content.
*
* @param in
* the stream to read from
- * @return the unencrypted line
+ *
+ * @return the unencrypted line or NULL
*
*
* @throws IOException
* in case of crypt error
*/
private String readLine(NextableInputStream in) throws IOException {
- String line = null;
if (in.next()) {
- line = IOUtils.readSmallStream(in);
- }
-
- if (line != null) {
+ String line = IOUtils.readSmallStream(in);
bytesReceived += line.length();
if (crypt != null) {
line = crypt.decrypt64s(line, false);
}
+
+ return line;
}
- return line;
+ return null;
}
/**
for (String key : new String[] { null,
"some super secret encryption key" }) {
// TODO: re-add bridge
- for (boolean bridge : new Boolean[] { false }) {
+ for (boolean bridge : new Boolean[] { false, true }) {
final String skey = (key != null ? "(encrypted)"
: "(plain text)");
final String sbridge = (bridge ? " with bridge" : "");
addSeries(new SerialServerTest(args, key, skey, bridge,
sbridge, "ServerString"));
- // addSeries(new SerialServerTest(args, key, skey, bridge,
- // sbridge, new Object() {
- // @Override
- // public String toString() {
- // return "ServerObject";
- // }
- // }));
+ addSeries(new SerialServerTest(args, key, skey, bridge,
+ sbridge, new Object() {
+ @Override
+ public String toString() {
+ return "ServerObject";
+ }
+ }));
}
}
}