< prev index next >

test/sun/net/www/MessageHeaderTest.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 8003948

  27  * @run main MessageHeaderTest
  28  */
  29 import java.io.*;
  30 import sun.net.www.MessageHeader;
  31 
  32 public class MessageHeaderTest {
  33     public static void main (String[] args) throws Exception {
  34         for (int i=0; i<7; i++) {
  35             ByteArrayInputStream bis = new ByteArrayInputStream(headers[i].getBytes());
  36             MessageHeader h = new MessageHeader(bis);
  37             String before = h.toString();
  38             before = before.substring(before.indexOf('{'));
  39             boolean result = h.filterNTLMResponses("WWW-Authenticate");
  40             String after = h.toString();
  41             after = after.substring(after.indexOf('{'));
  42             if (!expected[i].equals(after)) {
  43                 throw new RuntimeException(Integer.toString(i) + " expected != after");
  44             }
  45             if (result != expectedResult[i]) {
  46                 throw new RuntimeException(Integer.toString(i) + " result != expectedResult");




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 8003948
  27  * @modules java.base/sun.net.www
  28  * @run main MessageHeaderTest
  29  */
  30 import java.io.*;
  31 import sun.net.www.MessageHeader;
  32 
  33 public class MessageHeaderTest {
  34     public static void main (String[] args) throws Exception {
  35         for (int i=0; i<7; i++) {
  36             ByteArrayInputStream bis = new ByteArrayInputStream(headers[i].getBytes());
  37             MessageHeader h = new MessageHeader(bis);
  38             String before = h.toString();
  39             before = before.substring(before.indexOf('{'));
  40             boolean result = h.filterNTLMResponses("WWW-Authenticate");
  41             String after = h.toString();
  42             after = after.substring(after.indexOf('{'));
  43             if (!expected[i].equals(after)) {
  44                 throw new RuntimeException(Integer.toString(i) + " expected != after");
  45             }
  46             if (result != expectedResult[i]) {
  47                 throw new RuntimeException(Integer.toString(i) + " result != expectedResult");


< prev index next >