Code example for ProtocolException

0
            throw new ProtocolException("Must set doOutput");
        } 
 
        // you can't write after you read 
        if (sentRequest) {
            throw new ProtocolException("Can't write after you read");
        } 
 
        if (os != null) {
            return os;
        } 
 
        // they are requesting a stream to write to. This implies a POST method 
        if (method == GET) {
            method = POST;
        } 
 
        // If the request method is neither PUT or POST, then you're not writing 
        if (method != PUT && method != POST) {
            throw new ProtocolException("Can only write to PUT or POST");
Contextual code suggestions in your IDE  Get Codota for Java